From f01615cba34082934fca895e9a49b96af24b0f09 Mon Sep 17 00:00:00 2001 From: pontscho Date: Tue, 6 Nov 2001 12:32:27 +0000 Subject: [PATCH] add prostproc/rgb2rgb git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2734 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/mplayer/gtk/fs.h | 2 ++ Gui/wm/ws.c | 56 ++++++++++++++++++++++++++++++++------------ Gui/wm/wsconv.c | 16 ++++++------- 3 files changed, 51 insertions(+), 23 deletions(-) diff --git a/Gui/mplayer/gtk/fs.h b/Gui/mplayer/gtk/fs.h index 0bc7d105f9..56cbf92953 100644 --- a/Gui/mplayer/gtk/fs.h +++ b/Gui/mplayer/gtk/fs.h @@ -263,6 +263,8 @@ void fs_Ok_released( GtkButton * button,gpointer user_data ) strcpy( gtkShMem->fs.filename,fsSelectedFile ); printf( "----gtk---> directory: %s\n",fsSelectedDirectory ); printf( "----gtk---> filename: %s\n",fsSelectedFile ); +printf( "----gtksm-> directory: %s\n",gtkShMem->fs.dir ); +printf( "----gtksm-> filename: %s\n",gtkShMem->fs.filename ); item=fsTopList_items; while( item ) { diff --git a/Gui/wm/ws.c b/Gui/wm/ws.c index 1a95b6255f..3a4dee481f 100644 --- a/Gui/wm/ws.c +++ b/Gui/wm/ws.c @@ -16,9 +16,12 @@ #include #include +#include + #include "ws.h" #include "wsconv.h" #include "../../config.h" +#include "../../postproc/rgb2rgb.h" #include #ifdef HAVE_XSHAPE @@ -227,34 +230,57 @@ if(mDisplay){ #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 @@ void wsDoExit( void ) // 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 @@ void wsSetBackgroundRGB( wsTWindow * win,int r,int g,int b ) 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 @@ void wsSetForegroundRGB( wsTWindow * win,int r,int g,int b ) 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 ); } diff --git a/Gui/wm/wsconv.c b/Gui/wm/wsconv.c index 1f76be411e..aeff6ecf1f 100644 --- a/Gui/wm/wsconv.c +++ b/Gui/wm/wsconv.c @@ -22,7 +22,7 @@ void BGR8880_to_RGB555_c( unsigned char * in_pixels, unsigned char * out_pixels, { 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 @@ void BGR8880_to_BGR555_c( unsigned char * in_pixels, unsigned char * out_pixels, { 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 @@ void BGR8880_to_RGB565_c( unsigned char * in_pixels, unsigned char * out_pixels, { 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 @@ void BGR8880_to_BGR565_c( unsigned char * in_pixels, unsigned char * out_pixels, { 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_BGR565_c( unsigned char * in_pixels, unsigned char * out_pixels, 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_RGB888_c( unsigned char * in_pixels, unsigned char * out_pixels, 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_BGR888_c( unsigned char * in_pixels, unsigned char * out_pixels, 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_BGR8880_c( unsigned char * in_pixels, unsigned char * out_pixels } 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 ); } /*