Commit fb0eb672 authored by Sam Hocevar's avatar Sam Hocevar

. prototypes de fonctions pour le 8bpp

 . virage d'un bug dans le calcul de bytes_per_line (sauf fumage de ma part)
 . suppression de quelques #@@#@!!#@@#!@#@#! d'espaces en fin de ligne
 . quelques reformatages � 79 colonnes au lieu de @@#@!!#@@#!@#@#!# 81.
parent 5017b466
......@@ -36,23 +36,25 @@ typedef void (vout_yuv_convert_t)( p_vout_thread_t p_vout, void *p_pic,
typedef struct vout_yuv_s
{
/* Convertion 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 */
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 */
/* Pre-calculated convertion tables */
void * p_base; /* base for all convertion tables */
void * p_base; /* base for all convertion tables */
union
{
u16 * p_gray16; /* gray 16 bits table */
u32 * p_gray32; /* gray 32 bits table */
u16 * p_rgb16; /* RGB 16 bits table */
u32 * p_rgb32; /* RGB 32 bits table */
u8 * p_gray8; /* gray 8 bits table */
u16 * p_gray16; /* gray 16 bits table */
u32 * p_gray32; /* gray 32 bits table */
u8 * p_rgb8; /* RGB 8 bits table */
u16 * p_rgb16; /* RGB 16 bits table */
u32 * p_rgb32; /* RGB 32 bits table */
} yuv;
/* Temporary convertion buffer and offset array */
void * p_buffer; /* convertion buffer */
int * p_offset; /* offset array */
void * p_buffer; /* convertion buffer */
int * p_offset; /* offset array */
} vout_yuv_t;
/*******************************************************************************
......@@ -64,16 +66,16 @@ typedef struct vout_yuv_s
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_x, i_pic_y; /* picture position */
int i_pic_width, i_pic_height; /* picture extension */
/* Other areas - only vertical extensions of areas are stored */
int i_areas; /* number of areas */
int pi_area_begin[VOUT_MAX_AREAS]; /* beginning of area */
int pi_area_end[VOUT_MAX_AREAS]; /* end of area */
int i_areas; /* number of areas */
int pi_area_begin[VOUT_MAX_AREAS]; /* beginning of area */
int pi_area_end[VOUT_MAX_AREAS]; /* end of area */
/* Picture data */
byte_t * p_data; /* memory address */
byte_t * p_data; /* memory address */
} vout_buffer_t;
/*******************************************************************************
......@@ -86,68 +88,68 @@ typedef struct vout_buffer_s
typedef struct vout_thread_s
{
/* Thread properties and lock */
boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */
boolean_t b_active; /* `active' flag */
vlc_thread_t thread_id; /* id for pthread functions */
vlc_mutex_t picture_lock; /* picture heap lock */
vlc_mutex_t subpicture_lock; /* subpicture heap lock */
vlc_mutex_t change_lock; /* thread change lock */
int * pi_status; /* temporary status flag */
p_vout_sys_t p_sys; /* system output method */
boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */
boolean_t b_active; /* `active' flag */
vlc_thread_t thread_id; /* id for pthread functions */
vlc_mutex_t picture_lock; /* picture heap lock */
vlc_mutex_t subpicture_lock; /* subpicture heap lock */
vlc_mutex_t change_lock; /* thread change lock */
int * pi_status; /* temporary status flag */
p_vout_sys_t p_sys; /* system output method */
/* Current display properties */
u16 i_changes; /* changes made to the thread */
int i_width; /* current output method width */
int i_height; /* current output method height */
int i_bytes_per_line;/* bytes per line (including virtual) */
int i_screen_depth; /* bits per pixel */
int i_bytes_per_pixel; /* real screen depth */
float f_gamma; /* gamma */
u16 i_changes; /* changes made to the thread */
int i_width; /* current output method width */
int i_height; /* current output method height */
int i_bytes_per_line; /* bytes per line (incl. virtual) */
int i_screen_depth; /* bits per pixel */
int i_bytes_per_pixel; /* real screen depth */
float f_gamma; /* gamma */
/* Pictures and rendering properties */
boolean_t b_grayscale; /* color or grayscale display */
boolean_t b_info; /* print additionnal informations */
boolean_t b_interface; /* render interface */
boolean_t b_scale; /* allow picture scaling */
boolean_t b_grayscale; /* color or grayscale display */
boolean_t b_info; /* print additionnal informations */
boolean_t b_interface; /* render interface */
boolean_t b_scale; /* allow picture scaling */
/* Idle screens management */
mtime_t last_display_date; /* last non idle display date */
mtime_t last_idle_date; /* last idle display date */
mtime_t last_display_date; /* last non idle display date */
mtime_t last_idle_date; /* last idle display date */
#ifdef STATS
/* Statistics - these numbers are not supposed to be accurate, but are a
* good indication of the thread status */
mtime_t render_time; /* last picture render time */
count_t c_fps_samples; /* picture counts */
mtime_t p_fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */
mtime_t render_time; /* last picture render time */
count_t c_fps_samples; /* picture counts */
mtime_t p_fps_sample[ VOUT_FPS_SAMPLES ];/* FPS samples dates */
#endif
/* Rendering buffers */
int i_buffer_index; /* buffer index */
vout_buffer_t p_buffer[2]; /* buffers properties */
int i_buffer_index; /* buffer index */
vout_buffer_t p_buffer[2]; /* buffers properties */
/* Videos heap and translation tables */
picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /* subpictures */
vout_yuv_t yuv; /* translation tables */
picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /* subpictures */
vout_yuv_t yuv; /* translation tables */
/* Bitmap fonts */
p_vout_font_t p_default_font; /* default font */
p_vout_font_t p_large_font; /* large font */
p_vout_font_t p_default_font; /* default font */
p_vout_font_t p_large_font; /* large font */
} vout_thread_t;
/* Flags for changes - these flags are set in the i_changes field when another
* thread changed a variable */
#define VOUT_INFO_CHANGE 0x0001 /* b_info changed */
#define VOUT_GRAYSCALE_CHANGE 0x0002 /* b_grayscale changed */
#define VOUT_INTF_CHANGE 0x0004 /* b_interface changed */
#define VOUT_SCALE_CHANGE 0x0008 /* b_scale changed */
#define VOUT_SIZE_CHANGE 0x0200 /* size changed */
#define VOUT_DEPTH_CHANGE 0x0400 /* depth changed */
#define VOUT_GAMMA_CHANGE 0x0010 /* gamma changed */
#define VOUT_YUV_CHANGE 0x0800 /* change yuv tables */
#define VOUT_NODISPLAY_CHANGE 0xff00 /* changes which forbidden display */
#define VOUT_INFO_CHANGE 0x0001 /* b_info changed */
#define VOUT_GRAYSCALE_CHANGE 0x0002 /* b_grayscale changed */
#define VOUT_INTF_CHANGE 0x0004 /* b_interface changed */
#define VOUT_SCALE_CHANGE 0x0008 /* b_scale changed */
#define VOUT_SIZE_CHANGE 0x0200 /* size changed */
#define VOUT_DEPTH_CHANGE 0x0400 /* depth changed */
#define VOUT_GAMMA_CHANGE 0x0010 /* gamma changed */
#define VOUT_YUV_CHANGE 0x0800 /* change yuv tables */
#define VOUT_NODISPLAY_CHANGE 0xff00 /* changes which forbidden display */
/*******************************************************************************
* Prototypes
......
......@@ -199,24 +199,31 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
p_vout->i_width = p_vout->p_sys->var_info.xres;
p_vout->i_height = p_vout->p_sys->var_info.yres;
p_vout->i_bytes_per_line = p_vout->i_width * 2;
p_vout->i_screen_depth = p_vout->p_sys->var_info.bits_per_pixel;
switch( p_vout->i_screen_depth )
{
case 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */
case 8: /* 8 bpp */
p_vout->i_bytes_per_pixel = 1;
p_vout->i_bytes_per_line = p_vout->i_width;
break;
case 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */
p_vout->i_bytes_per_pixel = 2;
p_vout->i_bytes_per_line = p_vout->i_width * 2;
break;
case 24: /* 24 bpp (millions of colors) */
case 24: /* 24 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 3;
p_vout->i_bytes_per_line = p_vout->i_width * 3;
break;
case 32: /* 32 bpp (millions of colors) */
case 32: /* 32 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 4;
p_vout->i_bytes_per_line = p_vout->i_width * 4;
break;
default: /* unsupported screen depth */
default: /* unsupported screen depth */
intf_ErrMsg("vout error: screen depth %d is not supported\n",
p_vout->i_screen_depth);
return( 1 );
......@@ -256,3 +263,4 @@ static void FBCloseDisplay( vout_thread_t *p_vout )
// Destroy window and close display
close( p_vout->p_sys->i_fb_dev );
}
......@@ -30,24 +30,28 @@
/******************************************************************************
* Local prototypes
******************************************************************************/
static int InitThread ( vout_thread_t *p_vout );
static void RunThread ( vout_thread_t *p_vout );
static void ErrorThread ( vout_thread_t *p_vout );
static void EndThread ( vout_thread_t *p_vout );
static void DestroyThread ( vout_thread_t *p_vout, int i_status );
static void Print ( vout_thread_t *p_vout, int i_x, int i_y,
int i_h_align, int i_v_align, unsigned char *psz_text );
static void SetBufferArea ( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int i_h );
static void SetBufferPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderPictureInfo ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderSubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic );
static void RenderInterface ( vout_thread_t *p_vout );
static int RenderIdle ( vout_thread_t *p_vout );
static void RenderInfo ( vout_thread_t *p_vout );
static int Manage ( vout_thread_t *p_vout );
static int Align ( vout_thread_t *p_vout, int *pi_x, int *pi_y,
int i_width, int i_height, int i_h_align, int i_v_align );
static int InitThread ( vout_thread_t *p_vout );
static void RunThread ( vout_thread_t *p_vout );
static void ErrorThread ( vout_thread_t *p_vout );
static void EndThread ( vout_thread_t *p_vout );
static void DestroyThread ( vout_thread_t *p_vout, int i_status );
static void Print ( vout_thread_t *p_vout, int i_x, int i_y,
int i_h_align, int i_v_align,
unsigned char *psz_text );
static void SetBufferArea ( vout_thread_t *p_vout, int i_x, int i_y,
int i_w, int i_h );
static void SetBufferPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderPictureInfo ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderSubPicture ( vout_thread_t *p_vout,
subpicture_t *p_subpic );
static void RenderInterface ( vout_thread_t *p_vout );
static int RenderIdle ( vout_thread_t *p_vout );
static void RenderInfo ( vout_thread_t *p_vout );
static int Manage ( vout_thread_t *p_vout );
static int Align ( vout_thread_t *p_vout, int *pi_x,
int *pi_y, int i_width, int i_height,
int i_h_align, int i_v_align );
/******************************************************************************
* vout_CreateThread: creates a new video output thread
......@@ -62,7 +66,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
{
vout_thread_t * p_vout; /* thread descriptor */
int i_status; /* thread status */
int i_index; /* index for array initialization */
int i_index; /* index for array initialization */
/* Allocate descriptor */
intf_DbgMsg("\n");
......
......@@ -30,19 +30,19 @@
*******************************************************************************/
typedef struct vout_font_s
{
int i_type; /* font type */
int i_width; /* character width in pixels */
int i_height; /* character height in pixels */
int i_interspacing; /* characters interspacing in pixels */
int i_bytes_per_line; /* bytes per character line */
int i_bytes_per_char; /* bytes per character */
u16 i_first; /* first character */
u16 i_last; /* last character */
byte_t * p_data; /* font character data */
int i_type; /* font type */
int i_width; /* character width in pixels */
int i_height; /* character height in pixels */
int i_interspacing; /* characters interspacing in pixels */
int i_bytes_per_line; /* bytes per character line */
int i_bytes_per_char; /* bytes per character */
u16 i_first; /* first character */
u16 i_last; /* last character */
byte_t * p_data; /* font character data */
} vout_font_t;
/* Font types */
#define VOUT_FIXED_FONT 0 /* simple fixed font */
#define VOUT_FIXED_FONT 0 /* simple fixed font */
/*******************************************************************************
* vout_put_byte_t: PutByte function
......@@ -61,126 +61,132 @@ typedef void (vout_put_byte_t)( void *p_pic, int i_byte, int i_char, int i_borde
/* PUT_BYTE_MASK: put pixels from a byte-wide mask. It uses a branching tree
* to optimize the number of tests. It is used in the PutByte functions. */
#define TREE( i_mask, i_mask_color ) \
if( i_mask & 0xf0 ) /* one from 1111 */ \
{ \
if( i_mask & 0xc0 ) /* one from 1100 */ \
{ \
if( i_mask & 0x80 ) /* 1000 */ \
{ \
p_pic[0] = i_mask_color; \
if( i_mask & 0x40 ) /* 0100 */ \
{ \
p_pic[1] = i_mask_color; \
} \
} \
else /* not 1000 means 0100 */ \
{ \
p_pic[1] = i_mask_color; \
} \
if( i_mask & 0x30 ) /* one from 0011 */ \
{ \
if( i_mask & 0x20 ) /* 0010 */ \
{ \
p_pic[2] = i_mask_color; \
if( i_mask & 0x10 ) /* 0001 */ \
{ \
p_pic[3] = i_mask_color; \
} \
} \
else /* not 0010 means 0001 */ \
{ \
p_pic[3] = i_mask_color; \
} \
} \
} \
else /* not 1100 means 0011 */ \
{ \
if( i_mask & 0x20 ) /* 0010 */ \
{ \
p_pic[2] = i_mask_color; \
if( i_mask & 0x10 ) /* 0001 */ \
{ \
p_pic[3] = i_mask_color; \
} \
} \
else /* not 0010 means 0001 */ \
{ \
p_pic[3] = i_mask_color; \
} \
} \
} \
if( i_mask & 0x0f ) \
{ \
if( i_mask & 0x0c ) /* one from 1100 */ \
{ \
if( i_mask & 0x08 ) /* 1000 */ \
{ \
p_pic[4] = i_mask_color; \
if( i_mask & 0x04 ) /* 0100 */ \
{ \
p_pic[5] = i_mask_color; \
} \
} \
else /* not 1000 means 0100 */ \
{ \
p_pic[5] = i_mask_color; \
} \
if( i_mask & 0x03 ) /* one from 0011 */ \
{ \
if( i_mask & 0x02 ) /* 0010 */ \
{ \
p_pic[6] = i_mask_color; \
if( i_mask & 0x01 ) /* 0001 */ \
{ \
p_pic[7] = i_mask_color; \
} \
} \
else /* not 0010 means 0001 */ \
{ \
p_pic[7] = i_mask_color; \
} \
} \
} \
else /* not 1100 means 0011 */ \
{ \
if( i_mask & 0x02 ) /* 0010 */ \
{ \
p_pic[6] = i_mask_color; \
if( i_mask & 0x01 ) /* 0001 */ \
{ \
p_pic[7] = i_mask_color; \
} \
} \
else /* not 0010 means 0001 */ \
{ \
p_pic[7] = i_mask_color; \
} \
} \
#define TREE( i_mask, i_mask_color ) \
if( i_mask & 0xf0 ) /* one from 1111 */ \
{ \
if( i_mask & 0xc0 ) /* one from 1100 */ \
{ \
if( i_mask & 0x80 ) /* 1000 */ \
{ \
p_pic[0] = i_mask_color; \
if( i_mask & 0x40 ) /* 0100 */ \
{ \
p_pic[1] = i_mask_color; \
} \
} \
else /* not 1000 means 0100 */ \
{ \
p_pic[1] = i_mask_color; \
} \
if( i_mask & 0x30 ) /* one from 0011 */ \
{ \
if( i_mask & 0x20 ) /* 0010 */ \
{ \
p_pic[2] = i_mask_color; \
if( i_mask & 0x10 ) /* 0001 */ \
{ \
p_pic[3] = i_mask_color; \
} \
} \
else /* not 0010 means 0001 */ \
{ \
p_pic[3] = i_mask_color; \
} \
} \
} \
else /* not 1100 means 0011 */ \
{ \
if( i_mask & 0x20 ) /* 0010 */ \
{ \
p_pic[2] = i_mask_color; \
if( i_mask & 0x10 ) /* 0001 */ \
{ \
p_pic[3] = i_mask_color; \
} \
} \
else /* not 0010 means 0001 */ \
{ \
p_pic[3] = i_mask_color; \
} \
} \
} \
if( i_mask & 0x0f ) \
{ \
if( i_mask & 0x0c ) /* one from 1100 */ \
{ \
if( i_mask & 0x08 ) /* 1000 */ \
{ \
p_pic[4] = i_mask_color; \
if( i_mask & 0x04 ) /* 0100 */ \
{ \
p_pic[5] = i_mask_color; \
} \
} \
else /* not 1000 means 0100 */ \
{ \
p_pic[5] = i_mask_color; \
} \
if( i_mask & 0x03 ) /* one from 0011 */ \
{ \
if( i_mask & 0x02 ) /* 0010 */ \
{ \
p_pic[6] = i_mask_color; \
if( i_mask & 0x01 ) /* 0001 */ \
{ \
p_pic[7] = i_mask_color; \
} \
} \
else /* not 0010 means 0001 */ \
{ \
p_pic[7] = i_mask_color; \
} \
} \
} \
else /* not 1100 means 0011 */ \
{ \
if( i_mask & 0x02 ) /* 0010 */ \
{ \
p_pic[6] = i_mask_color; \
if( i_mask & 0x01 ) /* 0001 */ \
{ \
p_pic[7] = i_mask_color; \
} \
} \
else /* not 0010 means 0001 */ \
{ \
p_pic[7] = i_mask_color; \
} \
} \
}
/*******************************************************************************
/*****************************************************************************
* Local prototypes
*******************************************************************************/
static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border, int i_bg,
u32 i_char_color, u32 i_border_color, u32 i_bg_color );
static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
u32 i_char_color, u32 i_border_color, u32 i_bg_color );
static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
u32 i_char_color, u32 i_border_color, u32 i_bg_color );
/*******************************************************************************
*****************************************************************************/
static void PutByte8 ( u8 *p_pic, int i_byte, int i_char, int i_border,
int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color );
static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color );
static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border,
byte_t i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color );
static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border,
byte_t i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color );
/*****************************************************************************
* vout_LoadFont: load a bitmap font from a file
*******************************************************************************
*****************************************************************************
* This function will try to open a .psf font and load it. It will return
* NULL on error.
*******************************************************************************/
*****************************************************************************/
vout_font_t *vout_LoadFont( const char *psz_name )
{
int i_char, i_line; /* character and line indexes */
int i_file; /* source file */
byte_t pi_buffer[2]; /* file buffer */
vout_font_t * p_font; /* the font itself */
int i_char, i_line; /* character and line indexes */
int i_file; /* source file */
byte_t pi_buffer[2]; /* file buffer */
vout_font_t * p_font; /* the font itself */
/* Open file */
i_file = open( psz_name, O_RDONLY );
......@@ -335,38 +341,41 @@ void vout_TextSize( vout_font_t *p_font, int i_style, const char *psz_text, int
void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int i_bytes_per_line,
u32 i_char_color, u32 i_border_color, u32 i_bg_color, int i_style, const char *psz_text )
{
byte_t *p_char, *p_border; /* character and border mask data */
int i_char_mask, i_border_mask, i_bg_mask; /* masks */
int i_line; /* current line in character */
int i_byte; /* current byte in character */
int i_interspacing; /* offset between two chars */
int i_font_bytes_per_line, i_font_height; /* font properties */
vout_put_byte_t *p_PutByte; /* PutByte function */
byte_t *p_char, *p_border; /* character and border mask data */
int i_char_mask, i_border_mask, i_bg_mask; /* masks */
int i_line; /* current line in character */
int i_byte; /* current byte in character */
int i_interspacing; /* offset between two chars */
int i_font_bytes_per_line, i_font_height; /* font properties */
vout_put_byte_t *p_PutByte; /* PutByte function */
//?? background: can be something else that whole byte
/* Select output function */
switch( i_bytes_per_pixel )
{
case 2:
p_PutByte = (vout_put_byte_t *) PutByte16;
case 1:
p_PutByte = (vout_put_byte_t *) PutByte8;
break;
case 2:
p_PutByte = (vout_put_byte_t *) PutByte16;
break;
case 3:
p_PutByte = (vout_put_byte_t *) PutByte24;
break;
p_PutByte = (vout_put_byte_t *) PutByte24;
break;
case 4:
#ifndef DEBUG
default:
default:
#endif
p_PutByte = (vout_put_byte_t *) PutByte32;
break;
p_PutByte = (vout_put_byte_t *) PutByte32;
break;
#ifdef DEBUG
default:
intf_DbgMsg("error: invalid bytes per pixel %d\n", i_bytes_per_pixel );
p_PutByte = NULL;
intf_DbgMsg("error: invalid bytes per pixel %d\n", i_bytes_per_pixel );
p_PutByte = NULL;
break;
#endif
}
}
/* Choose masks and copy font data to local variables */
i_char_mask = (i_style & VOID_TEXT) ? 0 : 0xff;
......@@ -437,11 +446,29 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
/* following functions are local */
/*******************************************************************************
/*****************************************************************************
* PutByte8: print a fixed width font character byte in 15 or 16 bpp
*****************************************************************************/
static void PutByte8( u8 *p_pic, int i_byte, int i_char, int i_border,
int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color )
{
/* Computes position offset and background mask */
p_pic += 8 * i_byte;
i_bg &= ~(i_char | i_border);
/* Put character bits */
TREE(i_char, i_char_color);
TREE(i_border, i_border_color);
TREE(i_bg, i_bg_color);
}
/*****************************************************************************
* PutByte16: print a fixed width font character byte in 15 or 16 bpp
*******************************************************************************/
static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border, int i_bg,
u32 i_char_color, u32 i_border_color, u32 i_bg_color )
*****************************************************************************/
static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color )
{
/* Computes position offset and background mask */
p_pic += 8 * i_byte;
......@@ -453,18 +480,18 @@ static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border, int i_b
TREE(i_bg, i_bg_color);
}
/*******************************************************************************
/*****************************************************************************
* PutByte24: print a fixed width font character byte in 24 bpp
*******************************************************************************/
*****************************************************************************/
static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
u32 i_char_color, u32 i_border_color, u32 i_bg_color )
{
//??
}
/*******************************************************************************
/*****************************************************************************
* PutByte32: print a fixed width font character byte in 32 bpp
*******************************************************************************/
*****************************************************************************/
static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
u32 i_char_color, u32 i_border_color, u32 i_bg_color )
{
......
......@@ -295,17 +295,20 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
p_vout->p_sys->i_screen );
switch( p_vout->i_screen_depth )
{
case 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */
case 8: /* 24 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 1;
break;
case 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */
p_vout->i_bytes_per_pixel = 2;
break;
case 24: /* 24 bpp (millions of colors) */
case 24: /* 24 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 3;
break;
case 32: /* 32 bpp (millions of colors) */
case 32: /* 32 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 4;
break;
default: /* unsupported screen depth */
default: /* unsupported screen depth */
intf_ErrMsg("error: screen depth %d is not supported\n",
p_vout->i_screen_depth);
XCloseDisplay( p_vout->p_sys->p_display );
......@@ -419,13 +422,13 @@ static void X11DestroyWindow( vout_thread_t *p_vout )
*******************************************************************************/
static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
{
byte_t * pb_data; /* image data storage zone */
int i_quantum; /* XImage quantum (see below) */
byte_t * pb_data; /* image data storage zone */
int i_quantum; /* XImage quantum (see below) */
/* Allocate memory for image */
p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
pb_data = (byte_t *) malloc( p_vout->i_bytes_per_line * p_vout->i_height );
if( !pb_data ) /* error */
if( !pb_data ) /* error */
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM));
return( 1 );
......
......@@ -74,6 +74,9 @@ static void SetYUV ( vout_thread_t *p_vout );
static void SetOffset ( int i_width, int i_height, int i_pic_width, int i_pic_height,
boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset );
static void ConvertY4Gray8 ( 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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients );
static void ConvertY4Gray16 ( p_vout_thread_t p_vout, u16 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients );
......@@ -83,6 +86,15 @@ static void ConvertY4Gray24 ( p_vout_thread_t p_vout, void *p_pic, yuv_dat
static void ConvertY4Gray32 ( p_vout_thread_t p_vout, u32 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients );
static void ConvertYUV420RGB8 ( 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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients );
static void ConvertYUV422RGB8 ( 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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients );
static void ConvertYUV444RGB8 ( 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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients );
static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients );
......@@ -111,142 +123,145 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
int i_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients );
/*******************************************************************************
/*****************************************************************************
* CONVERT_YUV_PIXEL, CONVERT_Y_PIXEL: pixel convertion blocks
*******************************************************************************
*****************************************************************************
* These convertion routines are used by YUV convertion functions.
* Convertion are made from p_y, p_u, p_v, which are modified, to p_buffer,
* which is also modified.
*******************************************************************************/
#define CONVERT_Y_PIXEL \
/* Only Y sample is present */ \
p_ybase = p_yuv + *p_y++; \
*p_buffer++ = p_ybase[RED_OFFSET-((V_RED_COEF*128)>>SHIFT) + i_red] | \
p_ybase[GREEN_OFFSET-(((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) + i_green ] | \
p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue]; \
#define CONVERT_YUV_PIXEL \
/* Y, U and V samples are present */ \
i_uval = *p_u++; \
i_vval = *p_v++; \
i_red = (V_RED_COEF * i_vval) >> SHIFT; \
i_green = (U_GREEN_COEF * i_uval + V_GREEN_COEF * i_vval) >> SHIFT; \
i_blue = (U_BLUE_COEF * i_uval) >> SHIFT; \
CONVERT_Y_PIXEL \
/*******************************************************************************
*****************************************************************************/
#define CONVERT_Y_PIXEL \
/* Only Y sample is present */ \
p_ybase = p_yuv + *p_y++; \
*p_buffer++ = p_ybase[RED_OFFSET-((V_RED_COEF*128)>>SHIFT) + i_red] | \
p_ybase[GREEN_OFFSET-(((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) \
+ i_green ] | p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue];
#define CONVERT_YUV_PIXEL \
/* Y, U and V samples are present */ \
i_uval = *p_u++; \
i_vval = *p_v++; \
i_red = (V_RED_COEF * i_vval) >> SHIFT; \
i_green = (U_GREEN_COEF * i_uval + V_GREEN_COEF * i_vval) >> SHIFT; \
i_blue = (U_BLUE_COEF * i_uval) >> SHIFT; \
CONVERT_Y_PIXEL \
/*****************************************************************************
* SCALE_WIDTH: scale a line horizontally
*******************************************************************************
*****************************************************************************
* This macro scale a line using rendering buffer and offset array.
*******************************************************************************/
#define SCALE_WIDTH \
if( b_horizontal_scaling ) \
{ \
/* Horizontal scaling, convertion has been done to buffer. \
* Rewind buffer and offset, then copy and scale line */ \
p_buffer = p_buffer_start; \
p_offset = p_offset_start; \
for( i_x = i_pic_width / 16; i_x--; ) \
{ \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
} \
p_pic += i_pic_line_width; \
} \
else \
{ \
/* No scaling, convertion has been done directly in picture memory. \
* Increment of picture pointer to end of line is still needed */ \
p_pic += i_pic_width + i_pic_line_width; \
} \
/*******************************************************************************
*****************************************************************************/
#define SCALE_WIDTH \
if( b_horizontal_scaling ) \
{ \
/* Horizontal scaling, convertion has been done to buffer. \
* Rewind buffer and offset, then copy and scale line */ \
p_buffer = p_buffer_start; \
p_offset = p_offset_start; \
for( i_x = i_pic_width / 16; i_x--; ) \
{ \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
} \
p_pic += i_pic_line_width; \
} \
else \
{ \
/* No scaling, convertion has been done directly in picture memory. \
* Increment of picture pointer to end of line is still needed */ \
p_pic += i_pic_width + i_pic_line_width; \
} \
/*****************************************************************************
* SCALE_HEIGHT: handle vertical scaling
*******************************************************************************
*****************************************************************************
* This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
* 444 for RGB convertion, or 400 for gray convertion.
*******************************************************************************/
#define SCALE_HEIGHT( CHROMA ) \
/* If line is odd, rewind 4:2:0 U and V samples */ \
if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) ) \
{ \
p_u -= i_chroma_width; \
p_v -= i_chroma_width; \
} \
\
/* \
* Handle vertical scaling. The current line can be copied or next one \
* can be ignored. \
*/ \
switch( i_vertical_scaling ) \
{ \
case -1: /* vertical scaling factor is < 1 */ \
while( (i_scale_count -= i_pic_height) >= 0 ) \
{ \
/* Height reduction: skip next source line */ \
p_y += i_width; \
i_y++; \
if( (CHROMA == 420) || (CHROMA == 422) ) \
{ \
if( i_y & 0x1 ) \
{ \
p_u += i_chroma_width; \
p_v += i_chroma_width; \
} \
} \
else if( CHROMA == 444 ) \
{ \
p_u += i_width; \
p_v += i_width; \
} \
} \
i_scale_count += i_height; \
break; \
case 1: /* vertical scaling factor is > 1 */ \
while( (i_scale_count -= i_height) > 0 ) \
{ \
/* Height increment: copy previous picture line */ \
for( i_x = i_pic_width / 16; i_x--; ) \
{ \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
} \
p_pic += i_pic_line_width; \
p_pic_start += i_pic_line_width; \
} \
i_scale_count += i_pic_height; \
break; \
} \
/*******************************************************************************
*****************************************************************************/
#define SCALE_HEIGHT( CHROMA ) \
/* If line is odd, rewind 4:2:0 U and V samples */ \
if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) ) \
{ \
p_u -= i_chroma_width; \
p_v -= i_chroma_width; \
} \
\
/* \
* Handle vertical scaling. The current line can be copied or next one \
* can be ignored. \
*/ \
switch( i_vertical_scaling ) \
{ \
case -1: /* vertical scaling factor is < 1 */ \
while( (i_scale_count -= i_pic_height) >= 0 ) \
{ \
/* Height reduction: skip next source line */ \
p_y += i_width; \
i_y++; \
if( (CHROMA == 420) || (CHROMA == 422) ) \
{ \
if( i_y & 0x1 ) \
{ \
p_u += i_chroma_width; \
p_v += i_chroma_width; \
} \
} \
else if( CHROMA == 444 ) \
{ \
p_u += i_width; \
p_v += i_width; \
} \
} \
i_scale_count += i_height; \
break; \
case 1: /* vertical scaling factor is > 1 */ \
while( (i_scale_count -= i_height) > 0 ) \
{ \
/* Height increment: copy previous picture line */ \
for( i_x = i_pic_width / 16; i_x--; ) \
{ \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
} \
p_pic += i_pic_line_width; \
p_pic_start += i_pic_line_width; \
} \
i_scale_count += i_pic_height; \
break; \
} \
/*****************************************************************************
* vout_InitYUV: allocate and initialize translations tables
*******************************************************************************
*****************************************************************************
* This function will allocate memory to store translation tables, depending
* of the screen depth.
*******************************************************************************/
*****************************************************************************/
int vout_InitYUV( vout_thread_t *p_vout )
{
size_t tables_size; /* tables size, in bytes */
size_t tables_size; /* tables size, in bytes */
/* Computes tables size */
switch( p_vout->i_screen_depth )
{
case 8:
tables_size = sizeof( u8 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
break;
case 15:
case 16:
tables_size = sizeof( u16 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
......@@ -296,23 +311,23 @@ int vout_InitYUV( vout_thread_t *p_vout )
return( 0 );
}
/*******************************************************************************
/*****************************************************************************
* vout_ResetTables: re-initialize translations tables
*******************************************************************************
*****************************************************************************
* This function will initialize the tables allocated by vout_CreateTables and
* set functions pointers.
*******************************************************************************/
*****************************************************************************/
int vout_ResetYUV( vout_thread_t *p_vout )
{
vout_EndYUV( p_vout );
return( vout_InitYUV( p_vout ) );
}
/*******************************************************************************
/*****************************************************************************
* vout_EndYUV: destroy translations tables
*******************************************************************************
*****************************************************************************
* Free memory allocated by vout_CreateTables.
*******************************************************************************/
*****************************************************************************/
void vout_EndYUV( vout_thread_t *p_vout )
{
free( p_vout->yuv.p_base );
......@@ -322,12 +337,12 @@ void vout_EndYUV( vout_thread_t *p_vout )
/* following functions are local */
/*******************************************************************************
/*****************************************************************************
* BinaryLog: computes the base 2 log of a binary value
*******************************************************************************
*****************************************************************************
* This functions is used by MaskToShift during tables initialisation, to
* get a bit index from a binary value.
*******************************************************************************/
*****************************************************************************/
static int BinaryLog(u32 i)
{
int i_log;
......@@ -361,18 +376,18 @@ static int BinaryLog(u32 i)
return( i_log );
}
/*******************************************************************************
/*****************************************************************************
* MaskToShift: Transform a color mask into right and left shifts
*******************************************************************************
*****************************************************************************
* This function is used during table initialisation. It can return a value
*******************************************************************************/
*****************************************************************************/
static void MaskToShift (int *pi_right, int *pi_left, u32 i_mask)
{
u32 i_low, i_high; /* lower hand higher bits of the mask */
u32 i_low, i_high; /* lower hand higher bits of the mask */
/* Get bits */
i_low = i_mask & (- i_mask); /* lower bit of the mask */
i_high = i_mask + i_low; /* higher bit of the mask */
i_low = i_mask & (- i_mask); /* lower bit of the mask */
i_high = i_mask + i_low; /* higher bit of the mask */
/* Transform bits into an index */
i_low = BinaryLog (i_low);
......@@ -383,14 +398,14 @@ static void MaskToShift (int *pi_right, int *pi_left, u32 i_mask)
*pi_right = (8 - i_high + i_low);
}
/*******************************************************************************
/*****************************************************************************
* SetGammaTable: return intensity table transformed by gamma curve.
*******************************************************************************
*****************************************************************************
* pi_table is a table of 256 entries from 0 to 255.
*******************************************************************************/
*****************************************************************************/
static void SetGammaTable( int *pi_table, double f_gamma )
{
int i_y; /* base intensity */
int i_y; /* base intensity */
/* Use exp(gamma) instead of gamma */
f_gamma = exp(f_gamma );
......@@ -402,16 +417,16 @@ static void SetGammaTable( int *pi_table, double f_gamma )
}
}
/*******************************************************************************
/*****************************************************************************
* SetYUV: compute tables and set function pointers
+ *******************************************************************************/
+ *****************************************************************************/
static void SetYUV( vout_thread_t *p_vout )
{
int pi_gamma[256]; /* gamma table */
int i_index; /* index in tables */
int i_red_right, i_red_left; /* red shifts */
int i_green_right, i_green_left; /* green shifts */
int i_blue_right, i_blue_left; /* blue shifts */
int pi_gamma[256]; /* gamma table */
int i_index; /* index in tables */
int i_red_right, i_red_left; /* red shifts */
int i_green_right, i_green_left; /* green shifts */
int i_blue_right, i_blue_left; /* blue shifts */
/* Build gamma table */
SetGammaTable( pi_gamma, p_vout->f_gamma );
......@@ -421,6 +436,11 @@ static void SetYUV( vout_thread_t *p_vout )
*/
switch( p_vout->i_screen_depth )
{
case 8:
MaskToShift( &i_red_right, &i_red_left, 0xe0 );
MaskToShift( &i_green_right, &i_green_left, 0x1c );
MaskToShift( &i_blue_right, &i_blue_left, 0x03 );
break;
case 15:
MaskToShift( &i_red_right, &i_red_left, 0xf800 );
MaskToShift( &i_green_right, &i_green_left, 0x03e0 );
......@@ -452,6 +472,9 @@ static void SetYUV( vout_thread_t *p_vout )
/* Grayscale: build gray table */
switch( p_vout->i_screen_depth )
{
case 8:
p_vout->yuv.yuv.p_gray8 = (u8 *)p_vout->yuv.p_base + GRAY_MARGIN;
break;
case 15:
case 16:
p_vout->yuv.yuv.p_gray16 = (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
......@@ -503,6 +526,9 @@ static void SetYUV( vout_thread_t *p_vout )
/* Color: build red, green and blue tables */
switch( p_vout->i_screen_depth )
{
case 8:
p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
break;
case 15:
case 16:
p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
......@@ -513,7 +539,7 @@ static void SetYUV( vout_thread_t *p_vout )
}
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = (pi_gamma[0]>>i_green_right)<<i_green_left;
p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = (pi_gamma[0]>>i_green_right) <<i_green_left;
p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] = (pi_gamma[255]>>i_green_right)<<i_green_left;
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
......@@ -564,6 +590,11 @@ static void SetYUV( vout_thread_t *p_vout )
/* Grayscale */
switch( p_vout->i_screen_depth )
{
case 8:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray8;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray8;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray8;
break;
case 15:
case 16:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16;
......@@ -587,6 +618,11 @@ static void SetYUV( vout_thread_t *p_vout )
/* Color */
switch( p_vout->i_screen_depth )
{
case 8:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB8;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertYUV422RGB8;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertYUV444RGB8;
break;
case 15:
case 16:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB16;
......@@ -607,17 +643,17 @@ static void SetYUV( vout_thread_t *p_vout )
}
}
/*******************************************************************************
/*****************************************************************************
* SetOffset: build offset array for convertion functions
*******************************************************************************
*****************************************************************************
* This function will build an offset array used in later convertion functions.
* It will also set horizontal and vertical scaling indicators.
*******************************************************************************/
*****************************************************************************/
static void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height,
boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset )
{
int i_x; /* x position in destination */
int i_scale_count; /* modulo counter */
int i_x; /* x position in destination */
int i_scale_count; /* modulo counter */
/*
* Prepare horizontal offset array
......@@ -676,24 +712,93 @@ static void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_hei
}
}
/*******************************************************************************
/*****************************************************************************
* ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
*****************************************************************************/
static void ConvertY4Gray8( 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, int i_pic_height,
int i_pic_line_width, int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_chroma_width; /* chroma width, not used */
u8 * p_gray; /* base convertion table */
u8 * p_pic_start; /* beginning of the current line for copy */
u8 * p_buffer_start; /* convertion buffer start */
u8 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
*/
i_pic_line_width -= i_pic_width;
p_gray = p_vout->yuv.yuv.p_gray8;
p_buffer_start = p_vout->yuv.p_buffer;
p_offset_start = p_vout->yuv.p_offset;
SetOffset( i_width, i_height, i_pic_width, i_pic_height,
&b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
/*
* Perform convertion
*/
i_scale_count = i_pic_height;
for( i_y = 0; i_y < i_height; i_y++ )
{
/* Mark beginnning of line for possible later line copy, and initialize
* buffer */
p_pic_start = p_pic;
p_buffer = b_horizontal_scaling ? p_buffer_start : p_pic;
/* Do YUV convertion to buffer - YUV picture is always formed of 16
* pixels wide blocks */
for( i_x = i_width / 16; i_x--; )
{
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
*p_buffer++ = p_gray[ *p_y++ ];
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
SCALE_HEIGHT(400);
}
}
/*****************************************************************************
* ConvertY4Gray16: grayscale YUV 4:x:x to RGB 15 or 16 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertY4Gray16( p_vout_thread_t p_vout, u16 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_chroma_width; /* chroma width, not used */
u16 * p_gray; /* base convertion table */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* convertion buffer start */
u16 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_chroma_width; /* chroma width, not used */
u16 * p_gray; /* base convertion table */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* convertion buffer start */
u16 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
......@@ -744,9 +849,9 @@ static void ConvertY4Gray16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *p_y
}
}
/*******************************************************************************
/*****************************************************************************
* ConvertY4Gray24: grayscale YUV 4:x:x to RGB 24 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertY4Gray24( p_vout_thread_t p_vout, void *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
......@@ -754,24 +859,24 @@ static void ConvertY4Gray24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t *p_
//??
}
/*******************************************************************************
/*****************************************************************************
* ConvertY4Gray32: grayscale YUV 4:x:x to RGB 32 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertY4Gray32( p_vout_thread_t p_vout, u32 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_chroma_width; /* chroma width, not used */
u32 * p_gray; /* base convertion table */
u32 * p_pic_start; /* beginning of the current line for copy */
u32 * p_buffer_start; /* convertion buffer start */
u32 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_chroma_width; /* chroma width, not used */
u32 * p_gray; /* base convertion table */
u32 * p_pic_start; /* beginning of the current line for copy */
u32 * p_buffer_start; /* convertion buffer start */
u32 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
......@@ -822,9 +927,200 @@ static void ConvertY4Gray32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y
}
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
*****************************************************************************/
static void ConvertYUV420RGB8( 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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u8 * p_yuv; /* base convertion table */
u8 * p_ybase; /* Y dependant convertion table */
u8 * p_pic_start; /* beginning of the current line for copy */
u8 * p_buffer_start; /* convertion buffer start */
u8 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
*/
i_pic_line_width -= i_pic_width;
i_chroma_width = i_width / 2;
p_yuv = p_vout->yuv.yuv.p_rgb8;
p_buffer_start = p_vout->yuv.p_buffer;
p_offset_start = p_vout->yuv.p_offset;
SetOffset( i_width, i_height, i_pic_width, i_pic_height,
&b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
/*
* Perform convertion
*/
i_scale_count = i_pic_height;
for( i_y = 0; i_y < i_height; i_y++ )
{
/* Mark beginnning of line for possible later line copy, and initialize
* buffer */
p_pic_start = p_pic;
p_buffer = b_horizontal_scaling ? p_buffer_start : p_pic;
/* Do YUV convertion to buffer - YUV picture is always formed of 16
* pixels wide blocks */
for( i_x = i_width / 16; i_x--; )
{
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
SCALE_HEIGHT(420);
}
}
/*****************************************************************************
* ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
*****************************************************************************/
static void ConvertYUV422RGB8( 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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u8 * p_yuv; /* base convertion table */
u8 * p_ybase; /* Y dependant convertion table */
u8 * p_pic_start; /* beginning of the current line for copy */
u8 * p_buffer_start; /* convertion buffer start */
u8 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
*/
i_pic_line_width -= i_pic_width;
i_chroma_width = i_width / 2;
p_yuv = p_vout->yuv.yuv.p_rgb8;
p_buffer_start = p_vout->yuv.p_buffer;
p_offset_start = p_vout->yuv.p_offset;
SetOffset( i_width, i_height, i_pic_width, i_pic_height,
&b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
/*
* Perform convertion
*/
i_scale_count = i_pic_height;
for( i_y = 0; i_y < i_height; i_y++ )
{
/* Mark beginnning of line for possible later line copy, and initialize
* buffer */
p_pic_start = p_pic;
p_buffer = b_horizontal_scaling ? p_buffer_start : p_pic;
/* Do YUV convertion to buffer - YUV picture is always formed of 16
* pixels wide blocks */
for( i_x = i_width / 16; i_x--; )
{
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_Y_PIXEL;
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
SCALE_HEIGHT(422);
}
}
/*****************************************************************************
* ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
*****************************************************************************/
static void ConvertYUV444RGB8( 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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width, not used */
u8 * p_yuv; /* base convertion table */
u8 * p_ybase; /* Y dependant convertion table */
u8 * p_pic_start; /* beginning of the current line for copy */
u8 * p_buffer_start; /* convertion buffer start */
u8 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
*/
i_pic_line_width -= i_pic_width;
p_yuv = p_vout->yuv.yuv.p_rgb8;
p_buffer_start = p_vout->yuv.p_buffer;
p_offset_start = p_vout->yuv.p_offset;
SetOffset( i_width, i_height, i_pic_width, i_pic_height,
&b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
/*
* Perform convertion
*/
i_scale_count = i_pic_height;
for( i_y = 0; i_y < i_height; i_y++ )
{
/* Mark beginnning of line for possible later line copy, and initialize
* buffer */
p_pic_start = p_pic;
p_buffer = b_horizontal_scaling ? p_buffer_start : p_pic;
/* Do YUV convertion to buffer - YUV picture is always formed of 16
* pixels wide blocks */
for( i_x = i_width / 16; i_x--; )
{
CONVERT_YUV_PIXEL; CONVERT_YUV_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_YUV_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_YUV_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_YUV_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_YUV_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_YUV_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_YUV_PIXEL;
CONVERT_YUV_PIXEL; CONVERT_YUV_PIXEL;
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
SCALE_HEIGHT(444);
}
}
/*****************************************************************************
* ConvertYUV420RGB16: color YUV 4:2:0 to RGB 15 or 16 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
......@@ -840,20 +1136,20 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
i_scale, (u8 *)p_pic, 0, 0, (i_width + i_pic_eol) * sizeof( u16 ),
p_vout->i_screen_depth == 15 );
*/
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u16 * p_yuv; /* base convertion table */
u16 * p_ybase; /* Y dependant convertion table */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* convertion buffer start */
u16 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u16 * p_yuv; /* base convertion table */
u16 * p_ybase; /* Y dependant convertion table */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* convertion buffer start */
u16 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
......@@ -897,27 +1193,27 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
}
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV422RGB16: color YUV 4:2:2 to RGB 15 or 16 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV422RGB16( p_vout_thread_t p_vout, u16 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u16 * p_yuv; /* base convertion table */
u16 * p_ybase; /* Y dependant convertion table */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* convertion buffer start */
u16 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u16 * p_yuv; /* base convertion table */
u16 * p_ybase; /* Y dependant convertion table */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* convertion buffer start */
u16 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
......@@ -961,27 +1257,27 @@ static void ConvertYUV422RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
}
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV444RGB16: color YUV 4:4:4 to RGB 15 or 16 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV444RGB16( p_vout_thread_t p_vout, u16 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width, not used */
u16 * p_yuv; /* base convertion table */
u16 * p_ybase; /* Y dependant convertion table */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* convertion buffer start */
u16 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width, not used */
u16 * p_yuv; /* base convertion table */
u16 * p_ybase; /* Y dependant convertion table */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* convertion buffer start */
u16 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
......@@ -1024,9 +1320,9 @@ static void ConvertYUV444RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
}
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV420RGB24: color YUV 4:2:0 to RGB 24 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV420RGB24( p_vout_thread_t p_vout, void *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
......@@ -1034,9 +1330,9 @@ static void ConvertYUV420RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t
//???
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV422RGB24: color YUV 4:2:2 to RGB 24 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV422RGB24( p_vout_thread_t p_vout, void *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
......@@ -1044,9 +1340,9 @@ static void ConvertYUV422RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t
//???
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV444RGB24: color YUV 4:4:4 to RGB 24 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV444RGB24( p_vout_thread_t p_vout, void *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
......@@ -1054,27 +1350,27 @@ static void ConvertYUV444RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t
//???
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV420RGB32: color YUV 4:2:0 to RGB 32 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV420RGB32( p_vout_thread_t p_vout, u32 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u32 * p_yuv; /* base convertion table */
u32 * p_ybase; /* Y dependant convertion table */
u32 * p_pic_start; /* beginning of the current line for copy */
u32 * p_buffer_start; /* convertion buffer start */
u32 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u32 * p_yuv; /* base convertion table */
u32 * p_ybase; /* Y dependant convertion table */
u32 * p_pic_start; /* beginning of the current line for copy */
u32 * p_buffer_start; /* convertion buffer start */
u32 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
......@@ -1118,27 +1414,27 @@ static void ConvertYUV420RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
}
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV422RGB32: color YUV 4:2:2 to RGB 32 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV422RGB32( p_vout_thread_t p_vout, u32 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u32 * p_yuv; /* base convertion table */
u32 * p_ybase; /* Y dependant convertion table */
u32 * p_pic_start; /* beginning of the current line for copy */
u32 * p_buffer_start; /* convertion buffer start */
u32 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width */
u32 * p_yuv; /* base convertion table */
u32 * p_ybase; /* Y dependant convertion table */
u32 * p_pic_start; /* beginning of the current line for copy */
u32 * p_buffer_start; /* convertion buffer start */
u32 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
......@@ -1182,27 +1478,27 @@ static void ConvertYUV422RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
}
}
/*******************************************************************************
/*****************************************************************************
* ConvertYUV444RGB32: color YUV 4:4:4 to RGB 32 bpp
*******************************************************************************/
*****************************************************************************/
static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *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, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients )
{
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width, not used */
u32 * p_yuv; /* base convertion table */
u32 * p_ybase; /* Y dependant convertion table */
u32 * p_pic_start; /* beginning of the current line for copy */
u32 * p_buffer_start; /* convertion buffer start */
u32 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
boolean_t b_horizontal_scaling; /* horizontal scaling type */
int i_vertical_scaling; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_scale_count; /* scale modulo counter */
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
int i_chroma_width; /* chroma width, not used */
u32 * p_yuv; /* base convertion table */
u32 * p_ybase; /* Y dependant convertion table */
u32 * p_pic_start; /* beginning of the current line for copy */
u32 * p_buffer_start; /* convertion buffer start */
u32 * p_buffer; /* convertion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
/*
* Initialize some values - i_pic_line_width will store the line skip
......@@ -1245,7 +1541,7 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
}
}
//-------------------- walken code follow ---------------------------------------
//-------------------- walken code follows ------------------------------------
/*
* YUV to RGB routines.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment