mirror of https://github.com/mpv-player/mpv
add prostproc/rgb2rgb
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2734 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
dfe91abaa2
commit
f01615cba3
|
@ -263,6 +263,8 @@ void fs_Ok_released( GtkButton * button,gpointer user_data )
|
||||||
strcpy( gtkShMem->fs.filename,fsSelectedFile );
|
strcpy( gtkShMem->fs.filename,fsSelectedFile );
|
||||||
printf( "----gtk---> directory: %s\n",fsSelectedDirectory );
|
printf( "----gtk---> directory: %s\n",fsSelectedDirectory );
|
||||||
printf( "----gtk---> filename: %s\n",fsSelectedFile );
|
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;
|
item=fsTopList_items;
|
||||||
while( item )
|
while( item )
|
||||||
{
|
{
|
||||||
|
|
56
Gui/wm/ws.c
56
Gui/wm/ws.c
|
@ -16,9 +16,12 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "ws.h"
|
#include "ws.h"
|
||||||
#include "wsconv.h"
|
#include "wsconv.h"
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
|
#include "../../postproc/rgb2rgb.h"
|
||||||
|
|
||||||
#include <X11/extensions/XShm.h>
|
#include <X11/extensions/XShm.h>
|
||||||
#ifdef HAVE_XSHAPE
|
#ifdef HAVE_XSHAPE
|
||||||
|
@ -227,34 +230,57 @@ if(mDisplay){
|
||||||
#endif
|
#endif
|
||||||
initConverter();
|
initConverter();
|
||||||
wsOutMask=wsGetOutMask();
|
wsOutMask=wsGetOutMask();
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf( stderr,"[ws] Initialized converter: " );
|
||||||
|
#endif
|
||||||
switch ( wsOutMask )
|
switch ( wsOutMask )
|
||||||
{
|
{
|
||||||
case wsRGB32:
|
case wsRGB32:
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf( stderr,"rgb32 to rgb32\n" );
|
||||||
|
#endif
|
||||||
wsConvFunc=BGR8880_to_RGB8880_c;
|
wsConvFunc=BGR8880_to_RGB8880_c;
|
||||||
break;
|
break;
|
||||||
case wsBGR32:
|
case wsBGR32:
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf( stderr,"rgb32 to bgr32\n" );
|
||||||
|
#endif
|
||||||
wsConvFunc=BGR8880_to_BGR8880_c;
|
wsConvFunc=BGR8880_to_BGR8880_c;
|
||||||
break;
|
break;
|
||||||
case wsRGB24:
|
case wsRGB24:
|
||||||
#ifdef xHAVE_MMX
|
#ifdef DEBUG
|
||||||
wsConvFunc=BGR8880_to_RGB888_mmx;
|
fprintf( stderr,"rgb32 to rgb24\n" );
|
||||||
#else
|
|
||||||
wsConvFunc=BGR8880_to_RGB888_c;
|
|
||||||
#endif
|
#endif
|
||||||
|
wsConvFunc=rgb32to24;
|
||||||
break;
|
break;
|
||||||
case wsBGR24:
|
case wsBGR24:
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf( stderr,"rgb32 to bgr24\n" );
|
||||||
|
#endif
|
||||||
wsConvFunc=BGR8880_to_BGR888_c;
|
wsConvFunc=BGR8880_to_BGR888_c;
|
||||||
break;
|
break;
|
||||||
case wsRGB16:
|
case wsRGB16:
|
||||||
wsConvFunc=BGR8880_to_RGB565_c;
|
#ifdef DEBUG
|
||||||
|
fprintf( stderr,"rgb32 to rgb16\n" );
|
||||||
|
#endif
|
||||||
|
wsConvFunc=rgb32to16;
|
||||||
break;
|
break;
|
||||||
case wsBGR16:
|
case wsBGR16:
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf( stderr,"rgb32 to bgr16\n" );
|
||||||
|
#endif
|
||||||
wsConvFunc=BGR8880_to_BGR565_c;
|
wsConvFunc=BGR8880_to_BGR565_c;
|
||||||
break;
|
break;
|
||||||
case wsRGB15:
|
case wsRGB15:
|
||||||
wsConvFunc=BGR8880_to_RGB555_c;
|
#ifdef DEBUG
|
||||||
|
fprintf( stderr,"rgb32 to rgb15\n" );
|
||||||
|
#endif
|
||||||
|
wsConvFunc=rgb32to15;
|
||||||
break;
|
break;
|
||||||
case wsBGR15:
|
case wsBGR15:
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf( stderr,"rgb32 to bgr15\n" );
|
||||||
|
#endif
|
||||||
wsConvFunc=BGR8880_to_BGR555_c;
|
wsConvFunc=BGR8880_to_BGR555_c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -784,7 +810,7 @@ void wsDoExit( void )
|
||||||
// Put 'Image' to window.
|
// Put 'Image' to window.
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size )
|
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 )
|
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 wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break;
|
||||||
case wsBGR32:
|
case wsBGR32:
|
||||||
case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break;
|
case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break;
|
||||||
case wsRGB16: PACK_RGB16( r,g,b,color ); break;
|
case wsRGB16: PACK_RGB16( b,g,r,color ); break;
|
||||||
case wsBGR16: PACK_RGB16( b,g,r,color ); break;
|
case wsBGR16: PACK_RGB16( r,g,b,color ); break;
|
||||||
case wsRGB15: PACK_RGB15( r,g,b,color ); break;
|
case wsRGB15: PACK_RGB15( b,g,r,color ); break;
|
||||||
case wsBGR15: PACK_RGB15( b,g,r,color ); break;
|
case wsBGR15: PACK_RGB15( r,g,b,color ); break;
|
||||||
}
|
}
|
||||||
XSetWindowBackground( wsDisplay,win->WindowID,color );
|
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 wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break;
|
||||||
case wsBGR32:
|
case wsBGR32:
|
||||||
case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break;
|
case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break;
|
||||||
case wsRGB16: PACK_RGB16( r,g,b,color ); break;
|
case wsRGB16: PACK_RGB16( b,g,r,color ); break;
|
||||||
case wsBGR16: PACK_RGB16( b,g,r,color ); break;
|
case wsBGR16: PACK_RGB16( r,g,b,color ); break;
|
||||||
case wsRGB15: PACK_RGB15( r,g,b,color ); break;
|
case wsRGB15: PACK_RGB15( b,g,r,color ); break;
|
||||||
case wsBGR15: PACK_RGB15( b,g,r,color ); break;
|
case wsBGR15: PACK_RGB15( r,g,b,color ); break;
|
||||||
}
|
}
|
||||||
XSetForeground( wsDisplay,win->wGC,color );
|
XSetForeground( wsDisplay,win->wGC,color );
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ void BGR8880_to_RGB555_c( unsigned char * in_pixels, unsigned char * out_pixels,
|
||||||
{
|
{
|
||||||
unsigned short pixel;
|
unsigned short pixel;
|
||||||
int i;
|
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);
|
PACK_RGB15(in_pixels[0],in_pixels[1],in_pixels[2],pixel);
|
||||||
*(unsigned short*)out_pixels = 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;
|
unsigned short pixel;
|
||||||
int i;
|
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);
|
PACK_RGB15(in_pixels[2],in_pixels[1],in_pixels[0],pixel);
|
||||||
*(unsigned short*)out_pixels = 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;
|
unsigned short pixel;
|
||||||
int i;
|
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);
|
PACK_RGB16(in_pixels[0],in_pixels[1],in_pixels[2],pixel);
|
||||||
*(unsigned short*)out_pixels = 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;
|
unsigned short pixel;
|
||||||
int i;
|
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);
|
PACK_RGB16(in_pixels[2],in_pixels[1],in_pixels[0],pixel);
|
||||||
*(unsigned short*)out_pixels = 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 )
|
void BGR8880_to_RGB888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < num_pixels; i++)
|
for(i = 0; i < num_pixels / 4; i++)
|
||||||
{
|
{
|
||||||
COPY_RGB_24(in_pixels,out_pixels);
|
COPY_RGB_24(in_pixels,out_pixels);
|
||||||
in_pixels += 4;
|
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 )
|
void BGR8880_to_BGR888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < num_pixels; i++)
|
for(i = 0; i < num_pixels / 4; i++)
|
||||||
{
|
{
|
||||||
SWAP_RGB_24(in_pixels,out_pixels);
|
SWAP_RGB_24(in_pixels,out_pixels);
|
||||||
in_pixels += 4;
|
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 )
|
void BGR8880_to_BGR8880_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < num_pixels; i++)
|
for(i = 0; i < num_pixels / 4; i++)
|
||||||
{
|
{
|
||||||
SWAP_RGB_24(in_pixels,out_pixels);
|
SWAP_RGB_24(in_pixels,out_pixels);
|
||||||
in_pixels += 4;
|
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 )
|
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 ); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue