[Mplayer-cvslog] CVS: main/Gui/wm ws.c,1.21,1.22 wsconv.c,1.2,1.3

Zoltan Ponekker pontscho at mplayer.dev.hu
Tue Nov 6 13:32:52 CET 2001


Update of /cvsroot/mplayer/main/Gui/wm
In directory mplayer:/var/tmp.root/cvs-serv13318/Gui/wm

Modified Files:
	ws.c wsconv.c 
Log Message:
add prostproc/rgb2rgb

Index: ws.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/wm/ws.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ws.c	25 Oct 2001 23:34:03 -0000	1.21
+++ ws.c	6 Nov 2001 12:32:27 -0000	1.22
@@ -16,9 +16,12 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include <inttypes.h>
+
 #include "ws.h"
 #include "wsconv.h"
 #include "../../config.h"
+#include "../../postproc/rgb2rgb.h"
 
 #include <X11/extensions/XShm.h>
 #ifdef HAVE_XSHAPE
@@ -227,34 +230,57 @@
 #endif
  initConverter();
  wsOutMask=wsGetOutMask();
+ #ifdef DEBUG
+  fprintf( stderr,"[ws] Initialized converter: " );
+ #endif
  switch ( wsOutMask )
   {
    case wsRGB32:
+     #ifdef DEBUG
+      fprintf( stderr,"rgb32 to rgb32\n" );
+     #endif
      wsConvFunc=BGR8880_to_RGB8880_c;
      break;
    case wsBGR32:
+     #ifdef DEBUG
+      fprintf( stderr,"rgb32 to bgr32\n" );
+     #endif
      wsConvFunc=BGR8880_to_BGR8880_c;
      break;
    case wsRGB24:
-     #ifdef xHAVE_MMX
-      wsConvFunc=BGR8880_to_RGB888_mmx;
-     #else
-      wsConvFunc=BGR8880_to_RGB888_c;
+     #ifdef DEBUG
+      fprintf( stderr,"rgb32 to rgb24\n" );
      #endif
+     wsConvFunc=rgb32to24;
      break;
    case wsBGR24:
+     #ifdef DEBUG
+      fprintf( stderr,"rgb32 to bgr24\n" );
+     #endif
      wsConvFunc=BGR8880_to_BGR888_c;
      break;
    case wsRGB16:
-     wsConvFunc=BGR8880_to_RGB565_c;
+     #ifdef DEBUG
+      fprintf( stderr,"rgb32 to rgb16\n" );
+     #endif
+     wsConvFunc=rgb32to16;
      break;
    case wsBGR16:
+     #ifdef DEBUG
+      fprintf( stderr,"rgb32 to bgr16\n" );
+     #endif
      wsConvFunc=BGR8880_to_BGR565_c;
      break;
    case wsRGB15:
-     wsConvFunc=BGR8880_to_RGB555_c;
+     #ifdef DEBUG
+      fprintf( stderr,"rgb32 to rgb15\n" );
+     #endif
+     wsConvFunc=rgb32to15;
      break;
    case wsBGR15:
+     #ifdef DEBUG
+      fprintf( stderr,"rgb32 to bgr15\n" );
+     #endif
      wsConvFunc=BGR8880_to_BGR555_c;
      break;
   }
@@ -784,7 +810,7 @@
 //    Put 'Image' to window.
 // ----------------------------------------------------------------------------------------------
 void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size )
-{ if ( wsConvFunc ) wsConvFunc( Image,win->ImageData,win->xImage->width * win->xImage->height ); }
+{ if ( wsConvFunc ) wsConvFunc( Image,win->ImageData,win->xImage->width * win->xImage->height * 4 ); }
 
 void wsPutImage( wsTWindow * win )
 {
@@ -890,10 +916,10 @@
    case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b;  break;
    case wsBGR32:
    case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r;  break;
-   case wsRGB16: PACK_RGB16( r,g,b,color ); break;
-   case wsBGR16: PACK_RGB16( b,g,r,color ); break;
-   case wsRGB15: PACK_RGB15( r,g,b,color ); break;
-   case wsBGR15: PACK_RGB15( b,g,r,color ); break;
+   case wsRGB16: PACK_RGB16( b,g,r,color ); break;
+   case wsBGR16: PACK_RGB16( r,g,b,color ); break;
+   case wsRGB15: PACK_RGB15( b,g,r,color ); break;
+   case wsBGR15: PACK_RGB15( r,g,b,color ); break;
   }
  XSetWindowBackground( wsDisplay,win->WindowID,color );
 }
@@ -907,10 +933,10 @@
    case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b;  break;
    case wsBGR32:
    case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r;  break;
-   case wsRGB16: PACK_RGB16( r,g,b,color ); break;
-   case wsBGR16: PACK_RGB16( b,g,r,color ); break;
-   case wsRGB15: PACK_RGB15( r,g,b,color ); break;
-   case wsBGR15: PACK_RGB15( b,g,r,color ); break;
+   case wsRGB16: PACK_RGB16( b,g,r,color ); break;
+   case wsBGR16: PACK_RGB16( r,g,b,color ); break;
+   case wsRGB15: PACK_RGB15( b,g,r,color ); break;
+   case wsBGR15: PACK_RGB15( r,g,b,color ); break;
   }
  XSetForeground( wsDisplay,win->wGC,color );
 }

Index: wsconv.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/wm/wsconv.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- wsconv.c	4 Oct 2001 20:33:29 -0000	1.2
+++ wsconv.c	6 Nov 2001 12:32:27 -0000	1.3
@@ -22,7 +22,7 @@
 {
  unsigned short pixel;
  int i;
- for(i = 0; i < num_pixels; i++)
+ for(i = 0; i < num_pixels / 4; i++)
   {
    PACK_RGB15(in_pixels[0],in_pixels[1],in_pixels[2],pixel);
    *(unsigned short*)out_pixels = pixel;
@@ -35,7 +35,7 @@
 {
  unsigned short pixel;
  int i;
- for(i = 0; i < num_pixels; i++)
+ for(i = 0; i < num_pixels / 4; i++)
   {
    PACK_RGB15(in_pixels[2],in_pixels[1],in_pixels[0],pixel);
    *(unsigned short*)out_pixels = pixel;
@@ -48,7 +48,7 @@
 {
  unsigned short pixel;
  int i;
- for(i = 0; i < num_pixels; i++)
+ for(i = 0; i < num_pixels / 4; i++)
   {
    PACK_RGB16(in_pixels[0],in_pixels[1],in_pixels[2],pixel);
    *(unsigned short*)out_pixels = pixel;
@@ -61,7 +61,7 @@
 {
  unsigned short pixel;
  int i;
- for(i = 0; i < num_pixels; i++)
+ for(i = 0; i < num_pixels / 4; i++)
   {
    PACK_RGB16(in_pixels[2],in_pixels[1],in_pixels[0],pixel);
    *(unsigned short*)out_pixels = pixel;
@@ -73,7 +73,7 @@
 void BGR8880_to_RGB888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels )
 {
  int i;
- for(i = 0; i < num_pixels; i++)
+ for(i = 0; i < num_pixels / 4; i++)
   {
    COPY_RGB_24(in_pixels,out_pixels);
    in_pixels += 4;
@@ -84,7 +84,7 @@
 void BGR8880_to_BGR888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels )
 {
  int i;
- for(i = 0; i < num_pixels; i++)
+ for(i = 0; i < num_pixels / 4; i++)
   {
    SWAP_RGB_24(in_pixels,out_pixels);
    in_pixels += 4;
@@ -95,7 +95,7 @@
 void BGR8880_to_BGR8880_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels )
 {
  int i;
- for(i = 0; i < num_pixels; i++)
+ for(i = 0; i < num_pixels / 4; i++)
   {
    SWAP_RGB_24(in_pixels,out_pixels);
    in_pixels += 4;
@@ -104,7 +104,7 @@
 }
 
 void BGR8880_to_RGB8880_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels )
-{ memcpy( out_pixels,in_pixels,num_pixels * 4 ); }
+{ memcpy( out_pixels,in_pixels,num_pixels ); }
 
 /*
 




More information about the MPlayer-cvslog mailing list