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
...@@ -44,8 +44,10 @@ typedef struct vout_yuv_s ...@@ -44,8 +44,10 @@ typedef struct vout_yuv_s
void * p_base; /* base for all convertion tables */ void * p_base; /* base for all convertion tables */
union union
{ {
u8 * p_gray8; /* gray 8 bits table */
u16 * p_gray16; /* gray 16 bits table */ u16 * p_gray16; /* gray 16 bits table */
u32 * p_gray32; /* gray 32 bits table */ u32 * p_gray32; /* gray 32 bits table */
u8 * p_rgb8; /* RGB 8 bits table */
u16 * p_rgb16; /* RGB 16 bits table */ u16 * p_rgb16; /* RGB 16 bits table */
u32 * p_rgb32; /* RGB 32 bits table */ u32 * p_rgb32; /* RGB 32 bits table */
} yuv; } yuv;
...@@ -100,7 +102,7 @@ typedef struct vout_thread_s ...@@ -100,7 +102,7 @@ typedef struct vout_thread_s
u16 i_changes; /* changes made to the thread */ u16 i_changes; /* changes made to the thread */
int i_width; /* current output method width */ int i_width; /* current output method width */
int i_height; /* current output method height */ int i_height; /* current output method height */
int i_bytes_per_line;/* bytes per line (including virtual) */ int i_bytes_per_line; /* bytes per line (incl. virtual) */
int i_screen_depth; /* bits per pixel */ int i_screen_depth; /* bits per pixel */
int i_bytes_per_pixel; /* real screen depth */ int i_bytes_per_pixel; /* real screen depth */
float f_gamma; /* gamma */ float f_gamma; /* gamma */
...@@ -120,7 +122,7 @@ typedef struct vout_thread_s ...@@ -120,7 +122,7 @@ typedef struct vout_thread_s
* good indication of the thread status */ * good indication of the thread status */
mtime_t render_time; /* last picture render time */ mtime_t render_time; /* last picture render time */
count_t c_fps_samples; /* picture counts */ count_t c_fps_samples; /* picture counts */
mtime_t p_fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */ mtime_t p_fps_sample[ VOUT_FPS_SAMPLES ];/* FPS samples dates */
#endif #endif
/* Rendering buffers */ /* Rendering buffers */
......
...@@ -199,21 +199,28 @@ static int FBOpenDisplay( vout_thread_t *p_vout ) ...@@ -199,21 +199,28 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
p_vout->i_width = p_vout->p_sys->var_info.xres; 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_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; p_vout->i_screen_depth = p_vout->p_sys->var_info.bits_per_pixel;
switch( p_vout->i_screen_depth ) switch( p_vout->i_screen_depth )
{ {
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 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */ case 16: /* 16 bpp (65536 colors) */
p_vout->i_bytes_per_pixel = 2; p_vout->i_bytes_per_pixel = 2;
p_vout->i_bytes_per_line = p_vout->i_width * 2;
break; 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_pixel = 3;
p_vout->i_bytes_per_line = p_vout->i_width * 3;
break; 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_pixel = 4;
p_vout->i_bytes_per_line = p_vout->i_width * 4;
break; break;
default: /* unsupported screen depth */ default: /* unsupported screen depth */
...@@ -256,3 +263,4 @@ static void FBCloseDisplay( vout_thread_t *p_vout ) ...@@ -256,3 +263,4 @@ static void FBCloseDisplay( vout_thread_t *p_vout )
// Destroy window and close display // Destroy window and close display
close( p_vout->p_sys->i_fb_dev ); close( p_vout->p_sys->i_fb_dev );
} }
...@@ -36,18 +36,22 @@ static void ErrorThread ( vout_thread_t *p_vout ); ...@@ -36,18 +36,22 @@ static void ErrorThread ( vout_thread_t *p_vout );
static void EndThread ( 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 DestroyThread ( vout_thread_t *p_vout, int i_status );
static void Print ( vout_thread_t *p_vout, int i_x, int i_y, 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 ); int i_h_align, int i_v_align,
static void SetBufferArea ( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int i_h ); 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 SetBufferPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderPicture ( 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 RenderPictureInfo ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderSubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic ); static void RenderSubPicture ( vout_thread_t *p_vout,
subpicture_t *p_subpic );
static void RenderInterface ( vout_thread_t *p_vout ); static void RenderInterface ( vout_thread_t *p_vout );
static int RenderIdle ( vout_thread_t *p_vout ); static int RenderIdle ( vout_thread_t *p_vout );
static void RenderInfo ( vout_thread_t *p_vout ); static void RenderInfo ( vout_thread_t *p_vout );
static int Manage ( 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, static int Align ( vout_thread_t *p_vout, int *pi_x,
int i_width, int i_height, int i_h_align, int i_v_align ); 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 * vout_CreateThread: creates a new video output thread
......
...@@ -159,22 +159,28 @@ if( i_mask & 0x0f ) ...@@ -159,22 +159,28 @@ if( i_mask & 0x0f )
} \ } \
} }
/******************************************************************************* /*****************************************************************************
* Local prototypes * Local prototypes
*******************************************************************************/ *****************************************************************************/
static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border, int i_bg, static void PutByte8 ( u8 *p_pic, int i_byte, int i_char, int i_border,
u32 i_char_color, u32 i_border_color, u32 i_bg_color ); int i_bg, u32 i_char_color, u32 i_border_color,
static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg, u32 i_bg_color );
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,
static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg, int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_char_color, u32 i_border_color, u32 i_bg_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 * vout_LoadFont: load a bitmap font from a file
******************************************************************************* *****************************************************************************
* This function will try to open a .psf font and load it. It will return * This function will try to open a .psf font and load it. It will return
* NULL on error. * NULL on error.
*******************************************************************************/ *****************************************************************************/
vout_font_t *vout_LoadFont( const char *psz_name ) vout_font_t *vout_LoadFont( const char *psz_name )
{ {
int i_char, i_line; /* character and line indexes */ int i_char, i_line; /* character and line indexes */
...@@ -348,6 +354,9 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int ...@@ -348,6 +354,9 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
/* Select output function */ /* Select output function */
switch( i_bytes_per_pixel ) switch( i_bytes_per_pixel )
{ {
case 1:
p_PutByte = (vout_put_byte_t *) PutByte8;
break;
case 2: case 2:
p_PutByte = (vout_put_byte_t *) PutByte16; p_PutByte = (vout_put_byte_t *) PutByte16;
break; break;
...@@ -437,11 +446,29 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int ...@@ -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 */ /* 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 * 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, static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
u32 i_char_color, u32 i_border_color, u32 i_bg_color ) int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color )
{ {
/* Computes position offset and background mask */ /* Computes position offset and background mask */
p_pic += 8 * i_byte; 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 ...@@ -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); TREE(i_bg, i_bg_color);
} }
/******************************************************************************* /*****************************************************************************
* PutByte24: print a fixed width font character byte in 24 bpp * 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, 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 ) u32 i_char_color, u32 i_border_color, u32 i_bg_color )
{ {
//?? //??
} }
/******************************************************************************* /*****************************************************************************
* PutByte32: print a fixed width font character byte in 32 bpp * 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, 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 ) u32 i_char_color, u32 i_border_color, u32 i_bg_color )
{ {
......
...@@ -295,6 +295,9 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root ...@@ -295,6 +295,9 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
p_vout->p_sys->i_screen ); p_vout->p_sys->i_screen );
switch( p_vout->i_screen_depth ) switch( p_vout->i_screen_depth )
{ {
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 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */ case 16: /* 16 bpp (65536 colors) */
p_vout->i_bytes_per_pixel = 2; p_vout->i_bytes_per_pixel = 2;
......
...@@ -74,6 +74,9 @@ static void SetYUV ( vout_thread_t *p_vout ); ...@@ -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, 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 ); 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ); int i_matrix_coefficients );
...@@ -83,6 +86,15 @@ static void ConvertY4Gray24 ( p_vout_thread_t p_vout, void *p_pic, yuv_dat ...@@ -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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ); 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ); int i_matrix_coefficients );
...@@ -111,19 +123,19 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data ...@@ -111,19 +123,19 @@ 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ); int i_matrix_coefficients );
/******************************************************************************* /*****************************************************************************
* CONVERT_YUV_PIXEL, CONVERT_Y_PIXEL: pixel convertion blocks * CONVERT_YUV_PIXEL, CONVERT_Y_PIXEL: pixel convertion blocks
******************************************************************************* *****************************************************************************
* These convertion routines are used by YUV convertion functions. * 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, * Convertion are made from p_y, p_u, p_v, which are modified, to p_buffer,
* which is also modified. * which is also modified.
*******************************************************************************/ *****************************************************************************/
#define CONVERT_Y_PIXEL \ #define CONVERT_Y_PIXEL \
/* Only Y sample is present */ \ /* Only Y sample is present */ \
p_ybase = p_yuv + *p_y++; \ p_ybase = p_yuv + *p_y++; \
*p_buffer++ = p_ybase[RED_OFFSET-((V_RED_COEF*128)>>SHIFT) + i_red] | \ *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[GREEN_OFFSET-(((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) \
p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue]; \ + i_green ] | p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue];
#define CONVERT_YUV_PIXEL \ #define CONVERT_YUV_PIXEL \
/* Y, U and V samples are present */ \ /* Y, U and V samples are present */ \
...@@ -134,11 +146,11 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data ...@@ -134,11 +146,11 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
i_blue = (U_BLUE_COEF * i_uval) >> SHIFT; \ i_blue = (U_BLUE_COEF * i_uval) >> SHIFT; \
CONVERT_Y_PIXEL \ CONVERT_Y_PIXEL \
/******************************************************************************* /*****************************************************************************
* SCALE_WIDTH: scale a line horizontally * SCALE_WIDTH: scale a line horizontally
******************************************************************************* *****************************************************************************
* This macro scale a line using rendering buffer and offset array. * This macro scale a line using rendering buffer and offset array.
*******************************************************************************/ *****************************************************************************/
#define SCALE_WIDTH \ #define SCALE_WIDTH \
if( b_horizontal_scaling ) \ if( b_horizontal_scaling ) \
{ \ { \
...@@ -174,12 +186,12 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data ...@@ -174,12 +186,12 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
p_pic += i_pic_width + i_pic_line_width; \ p_pic += i_pic_width + i_pic_line_width; \
} \ } \
/******************************************************************************* /*****************************************************************************
* SCALE_HEIGHT: handle vertical scaling * SCALE_HEIGHT: handle vertical scaling
******************************************************************************* *****************************************************************************
* This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or * This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
* 444 for RGB convertion, or 400 for gray convertion. * 444 for RGB convertion, or 400 for gray convertion.
*******************************************************************************/ *****************************************************************************/
#define SCALE_HEIGHT( CHROMA ) \ #define SCALE_HEIGHT( CHROMA ) \
/* If line is odd, rewind 4:2:0 U and V samples */ \ /* If line is odd, rewind 4:2:0 U and V samples */ \
if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) ) \ if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) ) \
...@@ -234,12 +246,12 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data ...@@ -234,12 +246,12 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
break; \ break; \
} \ } \
/******************************************************************************* /*****************************************************************************
* vout_InitYUV: allocate and initialize translations tables * vout_InitYUV: allocate and initialize translations tables
******************************************************************************* *****************************************************************************
* This function will allocate memory to store translation tables, depending * This function will allocate memory to store translation tables, depending
* of the screen depth. * of the screen depth.
*******************************************************************************/ *****************************************************************************/
int vout_InitYUV( vout_thread_t *p_vout ) int vout_InitYUV( vout_thread_t *p_vout )
{ {
size_t tables_size; /* tables size, in bytes */ size_t tables_size; /* tables size, in bytes */
...@@ -247,6 +259,9 @@ int vout_InitYUV( vout_thread_t *p_vout ) ...@@ -247,6 +259,9 @@ int vout_InitYUV( vout_thread_t *p_vout )
/* Computes tables size */ /* Computes tables size */
switch( p_vout->i_screen_depth ) 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 15:
case 16: case 16:
tables_size = sizeof( u16 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE); 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 ) ...@@ -296,23 +311,23 @@ int vout_InitYUV( vout_thread_t *p_vout )
return( 0 ); return( 0 );
} }
/******************************************************************************* /*****************************************************************************
* vout_ResetTables: re-initialize translations tables * vout_ResetTables: re-initialize translations tables
******************************************************************************* *****************************************************************************
* This function will initialize the tables allocated by vout_CreateTables and * This function will initialize the tables allocated by vout_CreateTables and
* set functions pointers. * set functions pointers.
*******************************************************************************/ *****************************************************************************/
int vout_ResetYUV( vout_thread_t *p_vout ) int vout_ResetYUV( vout_thread_t *p_vout )
{ {
vout_EndYUV( p_vout ); vout_EndYUV( p_vout );
return( vout_InitYUV( p_vout ) ); return( vout_InitYUV( p_vout ) );
} }
/******************************************************************************* /*****************************************************************************
* vout_EndYUV: destroy translations tables * vout_EndYUV: destroy translations tables
******************************************************************************* *****************************************************************************
* Free memory allocated by vout_CreateTables. * Free memory allocated by vout_CreateTables.
*******************************************************************************/ *****************************************************************************/
void vout_EndYUV( vout_thread_t *p_vout ) void vout_EndYUV( vout_thread_t *p_vout )
{ {
free( p_vout->yuv.p_base ); free( p_vout->yuv.p_base );
...@@ -322,12 +337,12 @@ void vout_EndYUV( vout_thread_t *p_vout ) ...@@ -322,12 +337,12 @@ void vout_EndYUV( vout_thread_t *p_vout )
/* following functions are local */ /* following functions are local */
/******************************************************************************* /*****************************************************************************
* BinaryLog: computes the base 2 log of a binary value * BinaryLog: computes the base 2 log of a binary value
******************************************************************************* *****************************************************************************
* This functions is used by MaskToShift during tables initialisation, to * This functions is used by MaskToShift during tables initialisation, to
* get a bit index from a binary value. * get a bit index from a binary value.
*******************************************************************************/ *****************************************************************************/
static int BinaryLog(u32 i) static int BinaryLog(u32 i)
{ {
int i_log; int i_log;
...@@ -361,11 +376,11 @@ static int BinaryLog(u32 i) ...@@ -361,11 +376,11 @@ static int BinaryLog(u32 i)
return( i_log ); return( i_log );
} }
/******************************************************************************* /*****************************************************************************
* MaskToShift: Transform a color mask into right and left shifts * MaskToShift: Transform a color mask into right and left shifts
******************************************************************************* *****************************************************************************
* This function is used during table initialisation. It can return a value * This function is used during table initialisation. It can return a value
*******************************************************************************/ *****************************************************************************/
static void MaskToShift (int *pi_right, int *pi_left, u32 i_mask) 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 */
...@@ -383,11 +398,11 @@ static void MaskToShift (int *pi_right, int *pi_left, u32 i_mask) ...@@ -383,11 +398,11 @@ static void MaskToShift (int *pi_right, int *pi_left, u32 i_mask)
*pi_right = (8 - i_high + i_low); *pi_right = (8 - i_high + i_low);
} }
/******************************************************************************* /*****************************************************************************
* SetGammaTable: return intensity table transformed by gamma curve. * SetGammaTable: return intensity table transformed by gamma curve.
******************************************************************************* *****************************************************************************
* pi_table is a table of 256 entries from 0 to 255. * pi_table is a table of 256 entries from 0 to 255.
*******************************************************************************/ *****************************************************************************/
static void SetGammaTable( int *pi_table, double f_gamma ) static void SetGammaTable( int *pi_table, double f_gamma )
{ {
int i_y; /* base intensity */ int i_y; /* base intensity */
...@@ -402,9 +417,9 @@ static void SetGammaTable( int *pi_table, double f_gamma ) ...@@ -402,9 +417,9 @@ static void SetGammaTable( int *pi_table, double f_gamma )
} }
} }
/******************************************************************************* /*****************************************************************************
* SetYUV: compute tables and set function pointers * SetYUV: compute tables and set function pointers
+ *******************************************************************************/ + *****************************************************************************/
static void SetYUV( vout_thread_t *p_vout ) static void SetYUV( vout_thread_t *p_vout )
{ {
int pi_gamma[256]; /* gamma table */ int pi_gamma[256]; /* gamma table */
...@@ -421,6 +436,11 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -421,6 +436,11 @@ static void SetYUV( vout_thread_t *p_vout )
*/ */
switch( p_vout->i_screen_depth ) 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: case 15:
MaskToShift( &i_red_right, &i_red_left, 0xf800 ); MaskToShift( &i_red_right, &i_red_left, 0xf800 );
MaskToShift( &i_green_right, &i_green_left, 0x03e0 ); MaskToShift( &i_green_right, &i_green_left, 0x03e0 );
...@@ -452,6 +472,9 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -452,6 +472,9 @@ static void SetYUV( vout_thread_t *p_vout )
/* Grayscale: build gray table */ /* Grayscale: build gray table */
switch( p_vout->i_screen_depth ) 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 15:
case 16: case 16:
p_vout->yuv.yuv.p_gray16 = (u16 *)p_vout->yuv.p_base + GRAY_MARGIN; 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 ) ...@@ -503,6 +526,9 @@ static void SetYUV( vout_thread_t *p_vout )
/* Color: build red, green and blue tables */ /* Color: build red, green and blue tables */
switch( p_vout->i_screen_depth ) switch( p_vout->i_screen_depth )
{ {
case 8:
p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
break;
case 15: case 15:
case 16: case 16:
p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base; p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
...@@ -513,7 +539,7 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -513,7 +539,7 @@ static void SetYUV( vout_thread_t *p_vout )
} }
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ ) 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; 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++ ) for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
...@@ -564,6 +590,11 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -564,6 +590,11 @@ static void SetYUV( vout_thread_t *p_vout )
/* Grayscale */ /* Grayscale */
switch( p_vout->i_screen_depth ) 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 15:
case 16: case 16:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16; p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16;
...@@ -587,6 +618,11 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -587,6 +618,11 @@ static void SetYUV( vout_thread_t *p_vout )
/* Color */ /* Color */
switch( p_vout->i_screen_depth ) 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 15:
case 16: case 16:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB16; p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB16;
...@@ -607,12 +643,12 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -607,12 +643,12 @@ static void SetYUV( vout_thread_t *p_vout )
} }
} }
/******************************************************************************* /*****************************************************************************
* SetOffset: build offset array for convertion functions * SetOffset: build offset array for convertion functions
******************************************************************************* *****************************************************************************
* This function will build an offset array used in later convertion functions. * This function will build an offset array used in later convertion functions.
* It will also set horizontal and vertical scaling indicators. * 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, 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 ) boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset )
{ {
...@@ -676,9 +712,78 @@ static void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_hei ...@@ -676,9 +712,78 @@ 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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -744,9 +849,9 @@ static void ConvertY4Gray16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *p_y ...@@ -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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -754,9 +859,9 @@ static void ConvertY4Gray24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t *p_ ...@@ -754,9 +859,9 @@ 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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -822,9 +927,200 @@ static void ConvertY4Gray32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y ...@@ -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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -897,9 +1193,9 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t * ...@@ -897,9 +1193,9 @@ 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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -961,9 +1257,9 @@ static void ConvertYUV422RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t * ...@@ -961,9 +1257,9 @@ 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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -1024,9 +1320,9 @@ static void ConvertYUV444RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t * ...@@ -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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -1034,9 +1330,9 @@ static void ConvertYUV420RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t ...@@ -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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -1044,9 +1340,9 @@ static void ConvertYUV422RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t ...@@ -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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -1054,9 +1350,9 @@ static void ConvertYUV444RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t ...@@ -1054,9 +1350,9 @@ 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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -1118,9 +1414,9 @@ static void ConvertYUV420RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t * ...@@ -1118,9 +1414,9 @@ 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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -1182,9 +1478,9 @@ static void ConvertYUV422RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t * ...@@ -1182,9 +1478,9 @@ 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 * 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, 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_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
int i_matrix_coefficients ) int i_matrix_coefficients )
...@@ -1245,7 +1541,7 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t * ...@@ -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. * 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