Commit 52d7937c authored by Sam Hocevar's avatar Sam Hocevar

. rajout de l'option -Winline

 . fix de certaines fonctions qui devraient �tre inlin�es
 . gain de place dans la YUVMMX
parent e13aed00
[]
0.1.99f :
* plugin detection now works
* "gvlc", "fbvlc", "ggivlc" aliases now work
* fixed functions that weren't properly inlined
* removed bloat from the MMX YUV plugin
Thu Jul 20 15:14:06 CEST 2000
0.1.99e :
......
......@@ -8,6 +8,11 @@ A typical way to configure the vlc is :
./configure --prefix=/usr --enable-mmx --enable-gnome
For a full compilation, you may try :
./configure --prefix=/usr --enable-mmx --enable-gnome --enable-fb \
--enable-glide --enable-ggi --enable-mga --enable-esd
See `./configure --help' for more information.
Then, run `make', and `make install' to install it.
......
......@@ -79,12 +79,14 @@ endif
# C compiler flags: compilation
#
CCFLAGS += $(DEFINE) $(INCLUDE)
CCFLAGS += -Wall
CCFLAGS += -Wall -Winline
CCFLAGS += -D_REENTRANT
CCFLAGS += -D_GNU_SOURCE
# flags needed for clean beos compilation
ifeq ($(SYS),beos)
CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
endif
# Optimizations : don't compile debug versions with them
ifeq ($(DEBUG),0)
......
......@@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH VLC 1 "March 13, 2000"
.TH VLC 1 "July 30, 2000"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
......@@ -36,7 +36,7 @@ A summary of options is included below.
Disable audio output.
.TP
.B \-\-aout <plugin>
Specify an audio output plugin.
Specify an audio output plugin: "dsp", "esd", for instance.
.TP
.B \-\-stereo, \-\-mono
Choose stereo or mono audio output
......@@ -45,7 +45,10 @@ Choose stereo or mono audio output
Disable video output.
.TP
.B \-\-vout <plugin>
Specify a video output plugin.
Specify a video output plugin: "gnome", "fb", "glide", for instance.
.TP
.B \-\-yuv <plugin>
Specify a YUV plugin: "mmx", "nommx", for instance.
.TP
.B \-\-display <display>
Specify the display name.
......
......@@ -90,13 +90,13 @@ typedef struct picture_s
#define YUV_444_PICTURE 102 /* 4:4:4 YUV picture */
/* Pictures status */
#define FREE_PICTURE 0 /* picture is free and not allocated */
#define RESERVED_PICTURE 1 /* picture is allocated and reserved */
#define RESERVED_DATED_PICTURE 2 /* picture is waiting for DisplayPicture */
#define RESERVED_DISP_PICTURE 3 /* picture is waiting for a DatePixture */
#define READY_PICTURE 4 /* picture is ready for display */
#define DISPLAYED_PICTURE 5/* picture has been displayed but is linked */
#define DESTROYED_PICTURE 6 /* picture is allocated but no more used */
#define FREE_PICTURE 0 /* free and not allocated */
#define RESERVED_PICTURE 1 /* allocated and reserved */
#define RESERVED_DATED_PICTURE 2 /* waiting for DisplayPicture */
#define RESERVED_DISP_PICTURE 3 /* waiting for a DatePicture */
#define READY_PICTURE 4 /* ready for display */
#define DISPLAYED_PICTURE 5 /* been displayed but is linked */
#define DESTROYED_PICTURE 6 /* allocated but no more used */
/* Aspect ratios (ISO/IEC 13818-2 section 6.3.3, table 6-3) */
#define AR_SQUARE_PICTURE 1 /* square pixels */
......@@ -105,9 +105,9 @@ typedef struct picture_s
#define AR_221_1_PICTURE 4 /* 2.21:1 picture (movie) */
/*****************************************************************************
* subpicture_t: video sub picture unit
* subpicture_t: video subtitle
*****************************************************************************
* Any sub picture unit destined to be displayed by a video output thread should
* Any subtitle destined to be displayed by a video output thread should
* be stored in this structure from it's creation to it's effective display.
* Subtitle type and flags should only be modified by the output thread. Note
* that an empty subtitle MUST have its flags set to 0.
......@@ -118,7 +118,7 @@ typedef struct subpicture_s
int i_type; /* type */
int i_status; /* flags */
int i_size; /* data size */
struct subpicture_s * p_next; /* next SPU to be displayed */
struct subpicture_s * p_next; /* next subtitle to be displayed */
/* Other properties */
mtime_t begin_date; /* beginning of display date */
......@@ -126,7 +126,7 @@ typedef struct subpicture_s
/* Display properties - these properties are only indicative and may be
* changed by the video output thread, or simply ignored depending of the
* subpicture type. */
* subtitle type. */
int i_x; /* offset from alignment position */
int i_y; /* offset from alignment position */
int i_width; /* picture width */
......@@ -160,29 +160,29 @@ typedef struct subpicture_s
} subpicture_t;
/* Subpicture type */
#define EMPTY_SUBPICTURE 0 /* subtitle slot is empty and available */
#define DVD_SUBPICTURE 100 /* DVD subpicture unit */
#define TEXT_SUBPICTURE 200 /* single line text */
#define EMPTY_SUBPICTURE 0 /* subtitle slot is empty and available */
#define DVD_SUBPICTURE 100 /* DVD subpicture unit */
#define TEXT_SUBPICTURE 200 /* single line text */
/* Subpicture status */
#define FREE_SUBPICTURE 0 /* subpicture is free and not allocated */
#define RESERVED_SUBPICTURE 1 /* subpicture is allocated and reserved */
#define READY_SUBPICTURE 2 /* subpicture is ready for display */
#define DESTROYED_SUBPICTURE 3/* subpicture is allocated but no more used */
#define FREE_SUBPICTURE 0 /* free and not allocated */
#define RESERVED_SUBPICTURE 1 /* allocated and reserved */
#define READY_SUBPICTURE 2 /* ready for display */
#define DESTROYED_SUBPICTURE 3 /* allocated but not used anymore */
/* Alignment types */
#define RIGHT_ALIGN 10 /* x is absolute for right */
#define LEFT_ALIGN 11 /* x is absolute for left */
#define RIGHT_RALIGN 12 /* x is relative for right from right */
#define LEFT_RALIGN 13 /* x is relative for left from left */
#define CENTER_ALIGN 20 /* x, y are absolute for center */
#define CENTER_RALIGN 21 /* x, y are relative for center from center */
#define BOTTOM_ALIGN 30 /* y is absolute for bottom */
#define TOP_ALIGN 31 /* y is absolute for top */
#define BOTTOM_RALIGN 32 /* y is relative for bottom from bottom */
#define TOP_RALIGN 33 /* y is relative for top from top */
#define SUBTITLE_RALIGN 34 /* y is relative for center from subtitle */
#define RIGHT_ALIGN 10 /* x is absolute for right */
#define LEFT_ALIGN 11 /* x is absolute for left */
#define RIGHT_RALIGN 12 /* x is relative for right from right */
#define LEFT_RALIGN 13 /* x is relative for left from left */
#define CENTER_ALIGN 20 /* x, y are absolute for center */
#define CENTER_RALIGN 21 /* x,y are relative for center from center */
#define BOTTOM_ALIGN 30 /* y is absolute for bottom */
#define TOP_ALIGN 31 /* y is absolute for top */
#define BOTTOM_RALIGN 32 /* y is relative for bottom from bottom */
#define TOP_RALIGN 33 /* y is relative for top from top */
#define SUBTITLE_RALIGN 34 /* y is relative for center from subtitle */
......@@ -24,10 +24,10 @@
*****************************************************************************/
/*****************************************************************************
* vout_yuv_convert_t: YUV convertion function
* vout_yuv_convert_t: YUV conversion function
*****************************************************************************
* This is the prototype common to all convertion functions. The type of p_pic
* will change depending of the screen depth treated.
* This is the prototype common to all conversion functions. The type of p_pic
* will change depending on the processed screen depth.
* Parameters:
* p_vout video output thread
* p_pic picture address
......@@ -45,13 +45,13 @@ typedef void (vout_yuv_convert_t)( p_vout_thread_t p_vout, void *p_pic,
int i_matrix_coefficients );
/*****************************************************************************
* vout_yuv_t: pre-calculated YUV convertion tables
* vout_yuv_t: pre-calculated YUV conversion tables
*****************************************************************************
* These tables are used by convertion and scaling functions.
* These tables are used by conversion and scaling functions.
*****************************************************************************/
typedef struct vout_yuv_s
{
/* Convertion functions */
/* conversion functions */
vout_yuv_convert_t * p_Convert420; /* YUV 4:2:0 converter */
vout_yuv_convert_t * p_Convert422; /* YUV 4:2:2 converter */
vout_yuv_convert_t * p_Convert444; /* YUV 4:4:4 converter */
......@@ -69,21 +69,21 @@ typedef struct vout_yuv_s
} yuv;
/* Temporary conversion buffer and offset array */
void * p_buffer; /* convertion buffer */
void * p_buffer; /* conversion buffer */
int * p_offset; /* offset array */
} vout_yuv_t;
/*****************************************************************************
* vout_buffer_t: rendering buffer
*****************************************************************************
* This structure store informations about a buffer. Buffers are not completely
* This structure stores information about a buffer. Buffers are not completely
* cleared between displays, and modified areas need to be stored.
*****************************************************************************/
typedef struct vout_buffer_s
{
/* Picture area */
int i_pic_x, i_pic_y; /* picture position */
int i_pic_width, i_pic_height; /* picture extension */
int i_pic_width, i_pic_height; /* picture size */
/* Other areas - only vertical extensions of areas are stored */
int i_areas; /* number of areas */
......@@ -172,7 +172,7 @@ typedef struct vout_thread_s
/* Pictures and rendering properties */
boolean_t b_grayscale; /* color or grayscale display */
boolean_t b_info; /* print additionnal informations */
boolean_t b_info; /* print additional information */
boolean_t b_interface; /* render interface */
boolean_t b_scale; /* allow picture scaling */
......@@ -192,7 +192,7 @@ typedef struct vout_thread_s
int i_buffer_index; /* buffer index */
vout_buffer_t p_buffer[2]; /* buffers properties */
/* Videos heap and translation tables */
/* Video heap and translation tables */
picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /* subpictures */
int i_pictures; /* current heap size */
......@@ -202,7 +202,7 @@ typedef struct vout_thread_s
p_vout_font_t p_default_font; /* default font */
p_vout_font_t p_large_font; /* large font */
/* Synchronisation informations - synchro level is updated by the vout
/* Synchronization informations - synchro level is updated by the vout
* thread and read by decoder threads */
int i_synchro_level; /* trashing level */
} vout_thread_t;
......
......@@ -73,7 +73,6 @@ int aout_EsdOpen( aout_thread_t *p_aout )
int i_mode = ESD_STREAM;
int i_func = ESD_PLAY;
fprintf(stderr, "aout-esd !!\n");
/* Allocate structure */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL )
......
/*****************************************************************************
* video_yuv.c: YUV transformation functions
* video_yuv.c: MMX YUV transformation functions
* Provides functions to perform the YUV conversion. The functions provided here
* are a complete and portable C implementation, and may be replaced in certain
* case by optimized functions.
......@@ -55,31 +55,23 @@ int yuv_MMXInit( vout_thread_t *p_vout )
{
size_t tables_size; /* tables size, in bytes */
/* Computes tables size - 3 Bpp use 32 bits pixel entries in tables */
switch( p_vout->i_bytes_per_pixel )
/* Computes tables size for 8bbp only */
if( p_vout->i_bytes_per_pixel == 1 )
{
case 1:
tables_size = sizeof( u8 )
* (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE);
break;
case 2:
tables_size = sizeof( u16 )
* (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
break;
case 3:
case 4:
default:
tables_size = sizeof( u32 )
* (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
break;
}
/* Allocate memory */
p_vout->yuv.p_base = malloc( tables_size );
if( p_vout->yuv.p_base == NULL )
/* Allocate memory */
p_vout->yuv.p_base = malloc( tables_size );
if( p_vout->yuv.p_base == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM));
return( 1 );
}
}
else
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM));
return( 1 );
p_vout->yuv.p_base = NULL;
}
/* Allocate memory for conversion buffer and offset array */
......@@ -111,7 +103,11 @@ int yuv_MMXInit( vout_thread_t *p_vout )
*****************************************************************************/
void yuv_MMXEnd( vout_thread_t *p_vout )
{
free( p_vout->yuv.p_base );
if( p_vout->i_bytes_per_pixel == 1 )
{
free( p_vout->yuv.p_base );
}
free( p_vout->yuv.p_buffer );
free( p_vout->yuv.p_offset );
}
......@@ -130,25 +126,6 @@ int yuv_MMXReset( vout_thread_t *p_vout )
/* following functions are local */
/*****************************************************************************
* SetGammaTable: return intensity table transformed by gamma curve.
*****************************************************************************
* pi_table is a table of 256 entries from 0 to 255.
*****************************************************************************/
void SetGammaTable( int *pi_table, double f_gamma )
{
int i_y; /* base intensity */
/* Use exp(gamma) instead of gamma */
f_gamma = exp( f_gamma );
/* Build gamma table */
for( i_y = 0; i_y < 256; i_y++ )
{
pi_table[ i_y ] = pow( (double)i_y / 256, f_gamma ) * 256;
}
}
/*****************************************************************************
* SetYUV: compute tables and set function pointers
+ *****************************************************************************/
......@@ -166,136 +143,103 @@ void SetYUV( vout_thread_t *p_vout )
if( p_vout->b_grayscale )
{
/* Grayscale: build gray table */
switch( p_vout->i_bytes_per_pixel )
if( p_vout->i_bytes_per_pixel == 1 )
{
case 1:
{
u16 bright[256], transp[256];
u16 bright[256], transp[256];
p_vout->yuv.yuv.p_gray8 = (u8 *)p_vout->yuv.p_base + GRAY_MARGIN;
for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_gray8[ -i_index ] = RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
p_vout->yuv.yuv.p_gray8[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++)
{
p_vout->yuv.yuv.p_gray8[ i_index ] = pi_gamma[ i_index ];
bright[ i_index ] = i_index << 8;
transp[ i_index ] = 0;
}
/* the colors have been allocated, we can set the palette */
p_vout->p_set_palette( p_vout, bright, bright, bright, transp );
p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00;
p_vout->i_gray_pixel = 0x44;
p_vout->i_blue_pixel = 0x3b;
break;
}
case 2:
p_vout->yuv.yuv.p_gray16 = (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_gray16[ -i_index ] = RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
p_vout->yuv.yuv.p_gray16[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++)
{
p_vout->yuv.yuv.p_gray16[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
bright[ i_index ] = i_index << 8;
transp[ i_index ] = 0;
}
break;
case 3:
case 4:
p_vout->yuv.yuv.p_gray32 = (u32 *)p_vout->yuv.p_base + GRAY_MARGIN;
for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_gray32[ -i_index ] = RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
p_vout->yuv.yuv.p_gray32[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++)
{
p_vout->yuv.yuv.p_gray32[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
}
break;
}
/* the colors have been allocated, we can set the palette */
p_vout->p_set_palette( p_vout, bright, bright, bright, transp );
p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00;
p_vout->i_gray_pixel = 0x44;
p_vout->i_blue_pixel = 0x3b;
}
}
else
{
/* Color: build red, green and blue tables */
switch( p_vout->i_bytes_per_pixel )
if( p_vout->i_bytes_per_pixel == 1 )
{
case 1:
#define RGB_MIN 0
#define RGB_MAX 255
#define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
#define SHIFT 20
#define U_GREEN_COEF ((int)(-0.391 * (1<<SHIFT) / 1.164))
#define U_BLUE_COEF ((int)(2.018 * (1<<SHIFT) / 1.164))
#define V_RED_COEF ((int)(1.596 * (1<<SHIFT) / 1.164))
#define V_GREEN_COEF ((int)(-0.813 * (1<<SHIFT) / 1.164))
int y,u,v;
int r,g,b;
int uvr, uvg, uvb;
int i = 0, j = 0;
u16 red[256], green[256], blue[256], transp[256];
unsigned char lookup[PALETTE_TABLE_SIZE];
p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
/* this loop calculates the intersection of an YUV box
* and the RGB cube. */
for ( y = 0; y <= 256; y += 16 )
{
#define RGB_MIN 0
#define RGB_MAX 255
#define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
int y,u,v;
int r,g,b;
int uvr, uvg, uvb;
int i = 0, j = 0;
u16 red[256], green[256], blue[256], transp[256];
unsigned char lookup[PALETTE_TABLE_SIZE];
p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
/* this loop calculates the intersection of an YUV box
* and the RGB cube. */
for ( y = 0; y <= 256; y += 16 )
for ( u = 0; u <= 256; u += 32 )
for ( v = 0; v <= 256; v += 32 )
{
for ( u = 0; u <= 256; u += 32 )
for ( v = 0; v <= 256; v += 32 )
uvr = (V_RED_COEF*(v-128)) >> SHIFT;
uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
r = y + uvr;
g = y + uvg;
b = y + uvb;
if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
&& r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
{
uvr = (V_RED_COEF*(v-128)) >> SHIFT;
uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
r = y + uvr;
g = y + uvg;
b = y + uvb;
if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
&& r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
{
/* this one should never happen unless someone fscked up my code */
if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette\n" ); break; }
/* clip the colors */
red[j] = CLIP( r );
green[j] = CLIP( g );
blue[j] = CLIP( b );
transp[j] = 0;
/* allocate color */
lookup[i] = 1;
p_vout->yuv.yuv.p_rgb8[i++] = j;
j++;
}
else
{
lookup[i] = 0;
p_vout->yuv.yuv.p_rgb8[i++] = 0;
}
/* this one should never happen unless someone fscked up my code */
if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette\n" ); break; }
/* clip the colors */
red[j] = CLIP( r );
green[j] = CLIP( g );
blue[j] = CLIP( b );
transp[j] = 0;
/* allocate color */
lookup[i] = 1;
p_vout->yuv.yuv.p_rgb8[i++] = j;
j++;
}
else
{
lookup[i] = 0;
p_vout->yuv.yuv.p_rgb8[i++] = 0;
}
i += 128-81;
}
i += 128-81;
}
/* the colors have been allocated, we can set the palette */
/* there will eventually be a way to know which colors
* couldn't be allocated and try to find a replacement */
p_vout->p_set_palette( p_vout, red, green, blue, transp );
/* the colors have been allocated, we can set the palette */
/* there will eventually be a way to know which colors
* couldn't be allocated and try to find a replacement */
p_vout->p_set_palette( p_vout, red, green, blue, transp );
p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00;
p_vout->i_gray_pixel = 0x44;
p_vout->i_blue_pixel = 0x3b;
p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00;
p_vout->i_gray_pixel = 0x44;
p_vout->i_blue_pixel = 0x3b;
i = 0;
/* this loop allocates colors that got outside
* the RGB cube */
for ( y = 0; y <= 256; y += 16 )
i = 0;
/* this loop allocates colors that got outside
* the RGB cube */
for ( y = 0; y <= 256; y += 16 )
{
for ( u = 0; u <= 256; u += 32 )
{
for ( u = 0; u <= 256; u += 32 )
for ( v = 0; v <= 256; v += 32 )
{
int u2, v2;
......@@ -331,60 +275,9 @@ void SetYUV( vout_thread_t *p_vout )
}
i++;
}
i += 128-81;
}
break;
}
case 2:
p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
for( i_index = 0; i_index < RED_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
p_vout->yuv.yuv.p_rgb16[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
i += 128-81;
}
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++ )
{
p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
}
break;
case 3:
case 4:
p_vout->yuv.yuv.p_rgb32 = (u32 *)p_vout->yuv.p_base;
for( i_index = 0; i_index < RED_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
p_vout->yuv.yuv.p_rgb32[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
}
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++ )
{
p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
}
break;
}
}
......
/*****************************************************************************
* video_yuv.h: YUV transformation functions
* video_yuv.h: MMX YUV transformation functions
* Provides functions to perform the YUV conversion. The functions provided here
* are a complete and portable C implementation, and may be replaced in certain
* case by optimized functions.
......@@ -28,30 +28,11 @@
* Constants
*****************************************************************************/
/* Margins and offsets in conversion tables - Margins are used in case a RGB
* RGB conversion would give a value outside the 0-255 range. Offsets have been
* calculated to avoid using the same cache line for 2 tables. conversion tables
* are 2*MARGIN + 256 long and stores pixels.*/
#define RED_MARGIN 178
#define GREEN_MARGIN 135
#define BLUE_MARGIN 224
#define RED_OFFSET 1501 /* 1323 to 1935 */
#define GREEN_OFFSET 135 /* 0 to 526 */
#define BLUE_OFFSET 818 /* 594 to 1298 */
#define RGB_TABLE_SIZE 1935 /* total table size */
#define GRAY_MARGIN 384
#define GRAY_TABLE_SIZE 1024 /* total table size */
#define PALETTE_TABLE_SIZE 2176 /* YUV -> 8bpp palette lookup table */
/* macros used for YUV pixel conversions */
#define SHIFT 20
#define U_GREEN_COEF ((int)(-0.391 * (1<<SHIFT) / 1.164))
#define U_BLUE_COEF ((int)(2.018 * (1<<SHIFT) / 1.164))
#define V_RED_COEF ((int)(1.596 * (1<<SHIFT) / 1.164))
#define V_GREEN_COEF ((int)(-0.813 * (1<<SHIFT) / 1.164))
/* argument lists for YUV functions */
#define YUV_ARGS_8BPP p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_y, \
yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
......
......@@ -99,7 +99,10 @@ void ConvertYUV420RGB16( YUV_ARGS_16BPP )
__asm__( MMX_INIT_16
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
__asm__( ".align 8" MMX_YUV_MUL MMX_YUV_ADD MMX_UNPACK_16
__asm__( ".align 8"
MMX_YUV_MUL
MMX_YUV_ADD
MMX_UNPACK_16
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
p_y += 8;
......
/*****************************************************************************
* video_yuv24.c: YUV transformation functions for 24 bpp
* video_yuv24.c: MMX YUV transformation functions for 24 bpp
* Provides functions to perform the YUV conversion. The functions provided here
* are a complete and portable C implementation, and may be replaced in certain
* case by optimized functions.
......
/*****************************************************************************
* video_yuv32.c: YUV transformation functions for 32 bpp
* video_yuv32.c: MMX YUV transformation functions for 32 bpp
* Provides functions to perform the YUV conversion. The functions provided here
* are a complete and portable C implementation, and may be replaced in certain
* case by optimized functions.
......
/*****************************************************************************
* video_yuv8.c: YUV transformation functions for 8bpp
* video_yuv8.c: MMX YUV transformation functions for 8bpp
* Provides functions to perform the YUV conversion. The functions provided here
* are a complete and portable C implementation, and may be replaced in certain
* case by optimized functions.
......
/*****************************************************************************
* video_yuv_asm.h: YUV transformation assembly
* video_yuv_asm.h: MMX YUV transformation assembly
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
......@@ -82,7 +82,7 @@ movq %%mm1, %%mm3 # Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 \n\
pmulhw mmx_U_green, %%mm2 # Mul Cb with green coeff -> Cb green \n\
pmulhw mmx_V_green, %%mm3 # Mul Cr with green coeff -> Cr green \n\
pmulhw mmx_U_blue, %%mm0 # Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 \n\
pmulhw mmx_V_red, %%mm1 # Mul Cr -> Cred 00 r3 00 r2 00 r1 00 \n\
pmulhw mmx_V_red, %%mm1 # Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 \n\
paddsw %%mm3, %%mm2 # Cb green + Cr green -> Cgreen \n\
\n\
# convert the luma part \n\
......
/*****************************************************************************
* video_yuv_macros.h: YUV transformation macros
* video_yuv_macros.h: MMX YUV transformation macros
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
......
......@@ -74,6 +74,25 @@ void aout_Thread_U16_Stereo ( aout_thread_t * p_aout );
static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long l_numerator, long l_denominator );