/******************************************************************************
* Local prototypes
******************************************************************************/
+static int BinaryLog ( u32 i );
+static void MaskToShift ( int *pi_left, int *pi_right, u32 i_mask );
static int InitThread ( vout_thread_t *p_vout );
static void RunThread ( vout_thread_t *p_vout );
static void ErrorThread ( vout_thread_t *p_vout );
p_vout->i_bytes_per_pixel = 2;
p_vout->f_gamma = VOUT_GAMMA;
- p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR,
- VOUT_GRAYSCALE_DEFAULT );
+ p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT );
p_vout->b_info = 0;
p_vout->b_interface = 0;
p_vout->b_scale = 0;
- intf_DbgMsg("wished configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line)\n",
+ intf_DbgMsg("wished configuration: %dx%d, %d/%d bpp (%d Bpl)\n",
p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
- p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line );
+ p_vout->i_bytes_per_pixel * 8, p_vout->i_bytes_per_line );
/* Initialize idle screen */
p_vout->last_display_date = mdate();
free( p_vout );
return( NULL );
}
- intf_DbgMsg("actual configuration: %dx%d,%d (%d bytes/pixel, %d bytes/line)\n",
+ intf_DbgMsg("actual configuration: %dx%d, %d/%d bpp (%d Bpl), masks: 0x%x/0x%x/0x%x\n",
p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
- p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line );
+ p_vout->i_bytes_per_pixel * 8, p_vout->i_bytes_per_line,
+ p_vout->i_red_mask, p_vout->i_green_mask, p_vout->i_blue_mask );
+
+ /* Calculate shifts from system-updated masks */
+ MaskToShift( &p_vout->i_red_lshift, &p_vout->i_red_rshift, p_vout->i_red_mask );
+ MaskToShift( &p_vout->i_green_lshift, &p_vout->i_green_rshift, p_vout->i_green_mask );
+ MaskToShift( &p_vout->i_blue_lshift, &p_vout->i_blue_rshift, p_vout->i_blue_mask );
+
+ /* Set some usefull colors */
+ p_vout->i_white_pixel = RGB2PIXEL( p_vout, 255, 255, 255 );
+ p_vout->i_black_pixel = RGB2PIXEL( p_vout, 0, 0, 0 );
+ p_vout->i_gray_pixel = RGB2PIXEL( p_vout, 128, 128, 128 );
+ p_vout->i_blue_pixel = RGB2PIXEL( p_vout, 0, 0, 50 );
/* Load fonts - fonts must be initialized after the systme method since
* they may be dependant of screen depth and other thread properties */
return( NULL );
}
- intf_Msg("Video display initialized (%dx%d, %d bpp)\n",
- p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth );
+ intf_Msg("Video display initialized (%dx%d, %d/%d bpp)\n", p_vout->i_width,
+ p_vout->i_height, p_vout->i_screen_depth, p_vout->i_bytes_per_pixel * 8 );
/* If status is NULL, wait until the thread is created */
if( pi_status == NULL )
p_vout->p_buffer[1].p_data = p_buf2;
}
+/*****************************************************************************
+ * vout_Pixel2RGB: return red, green and blue from pixel value
+ *****************************************************************************
+ * Return color values, in 0-255 range, of the decomposition of a pixel. This
+ * is a slow routine and should only be used for initialization phase.
+ *****************************************************************************/
+void vout_Pixel2RGB( vout_thread_t *p_vout, u32 i_pixel, int *pi_red, int *pi_green, int *pi_blue )
+{
+ *pi_red = i_pixel & p_vout->i_red_mask;
+ *pi_green = i_pixel & p_vout->i_green_mask;
+ *pi_blue = i_pixel & p_vout->i_blue_mask;
+}
+
/* following functions are local */
+/*****************************************************************************
+ * BinaryLog: computes the base 2 log of a binary value
+ *****************************************************************************
+ * This functions is used by MaskToShift, to get a bit index from a binary
+ * value.
+ *****************************************************************************/
+static int BinaryLog(u32 i)
+{
+ int i_log;
+
+ i_log = 0;
+ if (i & 0xffff0000)
+ {
+ i_log = 16;
+ }
+ if (i & 0xff00ff00)
+ {
+ i_log += 8;
+ }
+ if (i & 0xf0f0f0f0)
+ {
+ i_log += 4;
+ }
+ if (i & 0xcccccccc)
+ {
+ i_log += 2;
+ }
+ if (i & 0xaaaaaaaa)
+ {
+ i_log++;
+ }
+ if (i != ((u32)1 << i_log))
+ {
+ intf_ErrMsg("internal error: binary log overflow\n");
+ }
+
+ return( i_log );
+}
+
+/*****************************************************************************
+ * MaskToShift: transform a color mask into right and left shifts
+ *****************************************************************************
+ * This function is used for obtaining color shifts from masks.
+ *****************************************************************************/
+static void MaskToShift( int *pi_left, int *pi_right, u32 i_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 */
+
+ /* Transform bits into an index */
+ i_low = BinaryLog (i_low);
+ i_high = BinaryLog (i_high);
+
+ /* Update pointers and return */
+ *pi_left = i_low;
+ *pi_right = (8 - i_high + i_low);
+}
+
/******************************************************************************
* InitThread: initialize video output thread
******************************************************************************
vout_Print( p_vout->p_default_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
i_y * p_vout->i_bytes_per_line + i_x * p_vout->i_bytes_per_pixel,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
- 0xffffffff, 0x00000000, 0x00000000, 0, psz_text );
+ p_vout->i_white_pixel, 0, 0,
+ 0, psz_text );
}
}
* Clear areas array
*/
p_buffer->i_areas = 0;
-
-#ifdef DEBUG_VIDEO
- /*
- * In DEBUG_VIDEO mode, draw white pixels at the beginning and the end of
- * the picture area. These pixels should not be erased by rendering functions,
- * otherwise segmentation fault is menacing !
- */
- if( i_pic_x > 0 )
- {
- *(u16*)(p_buffer->p_data + p_vout->i_bytes_per_line * i_pic_y +
- p_vout->i_bytes_per_pixel * (i_pic_x - 1)) = 0xffff;
- }
- if( i_pic_y > 0 )
- {
- *(u16*)(p_buffer->p_data + p_vout->i_bytes_per_line * (i_pic_y - 1) +
- p_vout->i_bytes_per_pixel * i_pic_x ) = 0xffff;
- }
- if( i_pic_x + i_pic_width < p_vout->i_width )
- {
- *(u16*)(p_buffer->p_data + p_vout->i_bytes_per_line * (i_pic_y + i_pic_height - 1) +
- p_vout->i_bytes_per_pixel * (i_pic_x + i_pic_width) ) = 0xffff;
- }
- if( i_pic_y + i_pic_height < p_vout->i_height )
- {
- *(u16*)(p_buffer->p_data + p_vout->i_bytes_per_line * (i_pic_y + i_pic_height) +
- p_vout->i_bytes_per_pixel * (i_pic_x + i_pic_width - 1) ) = 0xffff;
- }
-#endif
}
/******************************************************************************
p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
i_x * p_vout->i_bytes_per_pixel + i_y * p_vout->i_bytes_per_line,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
- 0xffffffff, 0x33333333, 0,
+ p_vout->i_white_pixel, p_vout->i_gray_pixel, 0,
WIDE_TEXT | OUTLINED_TEXT, psz_text );
SetBufferArea( p_vout, i_x, i_y, i_width, i_height );
}
{
int i_height, i_text_height; /* total and text height */
int i_width_1, i_width_2; /* text width */
- int i_byte; /* byte index */
+ int i_byte; /* byte index */
const char *psz_text_1 = "[1-9] Channel [i]nfo [c]olor [g/G]amma";
const char *psz_text_2 = "[+/-] Volume [m]ute [s]caling [Q]uit";
vout_TextSize( p_vout->p_large_font, OUTLINED_TEXT, psz_text_2, &i_width_2, &i_text_height );
i_height += i_text_height;
- /* Render background - effective background color will depend of the screen
- * depth */
+ /* Render background */
for( i_byte = (p_vout->i_height - i_height) * p_vout->i_bytes_per_line;
i_byte < p_vout->i_height * p_vout->i_bytes_per_line;
i_byte++ )
{
- p_vout->p_buffer[ p_vout->i_buffer_index ].p_data[ i_byte ] = 0x33;
+ //?? noooo !
+ p_vout->p_buffer[ p_vout->i_buffer_index ].p_data[ i_byte ] = p_vout->i_blue_pixel;
}
/* Render text, if not larger than screen */
vout_Print( p_vout->p_large_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
(p_vout->i_height - i_height) * p_vout->i_bytes_per_line,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
- 0xffffffff, 0x00000000, 0x00000000,
+ p_vout->i_white_pixel, p_vout->i_black_pixel, 0,
OUTLINED_TEXT, psz_text_1 );
}
if( i_width_2 < p_vout->i_width )
vout_Print( p_vout->p_large_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
(p_vout->i_height - i_height + i_text_height) * p_vout->i_bytes_per_line,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
- 0xffffffff, 0x00000000, 0x00000000,
+ p_vout->i_white_pixel, p_vout->i_black_pixel, 0,
OUTLINED_TEXT, psz_text_2 );
}
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
+#include "video_yuv.h"
#include "intf_msg.h"
/*******************************************************************************
typedef struct vout_sys_s
{
/* User settings */
- boolean_t b_shm; /* shared memory extension flag */
+ boolean_t b_shm; /* shared memory extension flag */
/* Internal settings and properties */
- Display * p_display; /* display pointer */
- int i_screen; /* screen number */
- Window root_window; /* root window */
- Window window; /* window instance handler */
- GC gc; /* graphic context instance handler */
+ Display * p_display; /* display pointer */
+ Visual * p_visual; /* visual pointer */
+ int i_screen; /* screen number */
+ Window root_window; /* root window */
+ Window window; /* window instance handler */
+ GC gc; /* graphic context instance handler */
+ Colormap colormap; /* colormap used (8bpp only) */
/* Display buffers and shared memory information */
- XImage * p_ximage[2]; /* XImage pointer */
- XShmSegmentInfo shm_info[2]; /* shared memory zone information */
+ XImage * p_ximage[2]; /* XImage pointer */
+ XShmSegmentInfo shm_info[2]; /* shared memory zone information */
} vout_sys_t;
-/*******************************************************************************
+/*****************************************************************************
* Local prototypes
- *******************************************************************************/
+ *****************************************************************************/
static int X11OpenDisplay ( vout_thread_t *p_vout, char *psz_display, Window root_window );
static void X11CloseDisplay ( vout_thread_t *p_vout );
static int X11CreateWindow ( vout_thread_t *p_vout );
static void X11DestroyShmImage ( vout_thread_t *p_vout, XImage *p_ximage,
XShmSegmentInfo *p_shm_info );
-
/*******************************************************************************
* vout_SysCreate: allocate X11 video thread output method
*******************************************************************************
*******************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
+ /*
+ * Color/Grayscale or gamma change: in 8bpp, just change the colormap
+ */
+ if( (p_vout->i_changes & VOUT_GRAYSCALE_CHANGE) && (p_vout->i_screen_depth == 8) )
+ {
+ //??
+ //?? clear flags
+ }
+
+ /*
+ * Size change
+ */
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{
intf_DbgMsg("resizing window\n");
/* following functions are local */
-/*******************************************************************************
+/*****************************************************************************
* X11OpenDisplay: open and initialize X11 device
- *******************************************************************************
+ *****************************************************************************
* Create a window according to video output given size, and set other
* properties according to the display properties.
- *******************************************************************************/
+ *****************************************************************************/
static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root_window )
{
+ XPixmapFormatValues * p_xpixmap_format; /* pixmap formats */
+ XVisualInfo * p_xvisual; /* visuals informations */
+ XVisualInfo xvisual_template; /* visual template */
+ int i_count; /* array size */
+
/* Open display */
p_vout->p_sys->p_display = XOpenDisplay( psz_display );
if( p_vout->p_sys->p_display == NULL )
intf_Msg("XShm video extension is not available\n");
}
- /* Get the screen depth */
- p_vout->i_screen_depth = DefaultDepth( p_vout->p_sys->p_display,
- p_vout->p_sys->i_screen );
+ /* Get screen depth */
+ p_vout->i_screen_depth = XDefaultDepth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
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 16: /* 16 bpp (65536 colors) */
- p_vout->i_bytes_per_pixel = 2;
- break;
- case 24: /* 24 bpp (millions of colors) */
- p_vout->i_bytes_per_pixel = 3;
- break;
- case 32: /* 32 bpp (millions of colors) */
- p_vout->i_bytes_per_pixel = 4;
+ case 8:
+ /*
+ * Screen depth is 8bpp. Use PseudoColor visual with private colormap.
+ */
+ xvisual_template.screen = p_vout->p_sys->i_screen;
+ xvisual_template.class = DirectColor;
+ p_xvisual = XGetVisualInfo( p_vout->p_sys->p_display, VisualScreenMask | VisualClassMask,
+ &xvisual_template, &i_count );
+ if( p_xvisual == NULL )
+ {
+ intf_ErrMsg("error: no PseudoColor visual available\n");
+ XCloseDisplay( p_vout->p_sys->p_display );
+ return( 1 );
+ }
+ //??
+ //?? SetColormap;
+ p_vout->i_bytes_per_pixel = 1;
break;
- 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 );
- return( 1 );
+ case 15:
+ case 16:
+ case 24:
+ default:
+ /*
+ * Screen depth is higher than 8bpp. TrueColor visual is used.
+ */
+ xvisual_template.screen = p_vout->p_sys->i_screen;
+ xvisual_template.class = TrueColor;
+ p_xvisual = XGetVisualInfo( p_vout->p_sys->p_display, VisualScreenMask | VisualClassMask,
+ &xvisual_template, &i_count );
+ if( p_xvisual == NULL )
+ {
+ intf_ErrMsg("error: no TrueColor visual available\n");
+ XCloseDisplay( p_vout->p_sys->p_display );
+ return( 1 );
+ }
+ p_vout->i_red_mask = p_xvisual->red_mask;
+ p_vout->i_green_mask = p_xvisual->green_mask;
+ p_vout->i_blue_mask = p_xvisual->blue_mask;
+
+ /* There is no difference yet between 3 and 4 Bpp. The only way to find
+ * the actual number of bytes per pixel is to list supported pixmap
+ * formats. */
+ p_xpixmap_format = XListPixmapFormats( p_vout->p_sys->p_display, &i_count );
+ p_vout->i_bytes_per_pixel = 0;
+ for( ; i_count--; p_xpixmap_format++ )
+ {
+ if( p_xpixmap_format->bits_per_pixel / 8 > p_vout->i_bytes_per_pixel )
+ {
+ p_vout->i_bytes_per_pixel = p_xpixmap_format->bits_per_pixel / 8;
+ }
+ }
break;
- }
+ }
+ p_vout->p_sys->p_visual = p_xvisual->visual;
+ XFree( p_xvisual );
/* Create a window */
if( X11CreateWindow( p_vout ) )
*******************************************************************************/
static void X11CloseDisplay( vout_thread_t *p_vout )
{
+ /* Destroy colormap */
+ if( p_vout->i_screen_depth == 8 )
+ {
+ XFreeColormap( p_vout->p_sys->p_display, p_vout->p_sys->colormap );
+ }
+
/* Destroy window and close display */
X11DestroyWindow( p_vout );
XCloseDisplay( p_vout->p_sys->p_display );
}
-/*******************************************************************************
+/******************************************************************************
* X11CreateWindow: create X11 vout window
- *******************************************************************************
+ ******************************************************************************
* The video output window will be created. Normally, this window is wether
* full screen or part of a parent window. Therefore, it does not need a
* title or other hints. Thery are still supplied in case the window would be
* spawned as a standalone one by the interface.
- *******************************************************************************/
+ ******************************************************************************/
static int X11CreateWindow( vout_thread_t *p_vout )
{
- XSetWindowAttributes xwindow_attributes;
- XGCValues xgcvalues;
- XEvent xevent;
- boolean_t b_expose;
- boolean_t b_map_notify;
+ XSetWindowAttributes xwindow_attributes; /* window attributes */
+ XGCValues xgcvalues; /* graphic context configuration */
+ XEvent xevent; /* first events */
+ boolean_t b_expose; /* 'expose' event received */
+ boolean_t b_map_notify; /* 'map_notify' event received */
/* Prepare window attributes */
- xwindow_attributes.backing_store = Always; /* save the hidden part */
+ xwindow_attributes.backing_store = Always; /* save the hidden part */
/* Create the window and set hints */
p_vout->p_sys->window = XCreateSimpleWindow( p_vout->p_sys->p_display,
}
/* Create XImage */
- *pp_ximage = XCreateImage( p_vout->p_sys->p_display,
- DefaultVisual(p_vout->p_sys->p_display, p_vout->p_sys->i_screen),
+ *pp_ximage = XCreateImage( p_vout->p_sys->p_display, p_vout->p_sys->p_visual,
p_vout->i_screen_depth, ZPixmap, 0, pb_data,
p_vout->i_width, p_vout->i_height, i_quantum, 0);
if(! *pp_ximage ) /* error */
XShmSegmentInfo *p_shm_info)
{
/* Create XImage */
- *pp_ximage = XShmCreateImage( p_vout->p_sys->p_display,
- DefaultVisual(p_vout->p_sys->p_display, p_vout->p_sys->i_screen),
+ *pp_ximage = XShmCreateImage( p_vout->p_sys->p_display, p_vout->p_sys->p_visual,
p_vout->i_screen_depth, ZPixmap, 0,
p_shm_info, p_vout->i_width, p_vout->i_height );
if(! *pp_ximage ) /* error */
* Constants
*******************************************************************************/
+/* Color masks for different color depths - 8bpp masks can be choosen, since
+ * colormaps instead of hardware-defined colors are used. */
+//?? remove
+#define RED_8BPP_MASK 0xe0
+#define GREEN_8BPP_MASK 0x1c
+#define BLUE_8BPP_MASK 0x03
+
+#define RED_15BPP_MASK 0xf800
+#define GREEN_15BPP_MASK 0x03e0
+#define BLUE_15BPP_MASK 0x001f
+
+#define RED_16BPP_MASK 0xf800
+#define GREEN_16BPP_MASK 0x07e0
+#define BLUE_16BPP_MASK 0x001f
+
+#define RED_24BPP_MASK 0xff0000
+#define GREEN_24BPP_MASK 0x00ff00
+#define BLUE_24BPP_MASK 0x0000ff
+
/* RGB/YUV inversion matrix (ISO/IEC 13818-2 section 6.3.6, table 6.9) */
//?? no more used ?
const int MATRIX_COEFFICIENTS_TABLE[8][4] =
/*******************************************************************************
* Local prototypes
*******************************************************************************/
-static int BinaryLog ( u32 i );
-static void MaskToShift ( int *pi_right, int *pi_left, u32 i_mask );
static void SetGammaTable ( int *pi_table, double f_gamma );
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,
* Convertion are made from p_y, p_u, p_v, which are modified, to p_buffer,
* which is also modified.
*****************************************************************************/
-#define CONVERT_Y_PIXEL \
+#define CONVERT_Y_PIXEL( BPP ) \
/* 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 \
+#define CONVERT_YUV_PIXEL( BPP ) \
/* 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 \
+ CONVERT_Y_PIXEL( BPP ) \
/*****************************************************************************
* 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. It works
+ * for 1, 2 and 4 Bpp.
*****************************************************************************/
#define SCALE_WIDTH \
if( b_horizontal_scaling ) \
* 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.
+ * 444 for RGB convertion, or 400 for gray convertion. It works for 1, 2, 3
+ * and 4 Bpp.
*****************************************************************************/
-#define SCALE_HEIGHT( CHROMA ) \
+#define SCALE_HEIGHT( CHROMA, BPP ) \
/* If line is odd, rewind 4:2:0 U and V samples */ \
if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) ) \
{ \
{ \
*(((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)++ ); \
+ if( BPP > 1 ) /* 2, 3, 4 Bpp */ \
+ { \
+ *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
+ *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
+ } \
+ if( BPP > 2 ) /* 3, 4 Bpp */ \
+ { \
+ *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
+ *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
+ } \
+ if( BPP > 3 ) /* 4 Bpp */ \
+ { \
+ *(((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; \
{
size_t tables_size; /* tables size, in bytes */
- /* Computes tables size */
- switch( p_vout->i_screen_depth )
+ /* Computes tables size - 3 Bpp use 32 bits pixel entries in tables */
+ switch( p_vout->i_bytes_per_pixel )
{
- case 8:
+ case 1:
tables_size = sizeof( u8 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
break;
- case 15:
- case 16:
+ case 2:
tables_size = sizeof( u16 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
break;
- case 24:
- case 32:
-#ifndef DEBUG
- default:
-#endif
+ case 3:
+ case 4:
+ default:
tables_size = sizeof( u32 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
break;
-#ifdef DEBUG
- default:
- intf_DbgMsg("error: invalid screen depth %d\n", p_vout->i_screen_depth );
- tables_size = 0;
- break;
-#endif
}
/* Allocate memory */
/* 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;
-
- i_log = 0;
- if (i & 0xffff0000)
- {
- i_log = 16;
- }
- if (i & 0xff00ff00)
- {
- i_log += 8;
- }
- if (i & 0xf0f0f0f0)
- {
- i_log += 4;
- }
- if (i & 0xcccccccc)
- {
- i_log += 2;
- }
- if (i & 0xaaaaaaaa)
- {
- i_log++;
- }
- if (i != ((u32)1 << i_log))
- {
- intf_ErrMsg("internal error: binary log overflow\n");
- }
-
- 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 */
-
- /* Get bits */
- 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);
- i_high = BinaryLog (i_high);
-
- /* Update pointers and return */
- *pi_left = i_low;
- *pi_right = (8 - i_high + i_low);
-}
-
/*****************************************************************************
* SetGammaTable: return intensity table transformed by gamma curve.
*****************************************************************************
{
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 );
- /*
- * Set color masks and shifts
- */
- 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 );
- MaskToShift( &i_blue_right, &i_blue_left, 0x001f );
- break;
- case 16:
- MaskToShift( &i_red_right, &i_red_left, 0xf800 );
- MaskToShift( &i_green_right, &i_green_left, 0x07e0 );
- MaskToShift( &i_blue_right, &i_blue_left, 0x001f );
- break;
- case 24:
- case 32:
- MaskToShift( &i_red_right, &i_red_left, 0x00ff0000 );
- MaskToShift( &i_green_right, &i_green_left, 0x0000ff00 );
- MaskToShift( &i_blue_right, &i_blue_left, 0x000000ff );
- break;
-#ifdef DEBUG
- default:
- intf_DbgMsg("error: invalid screen depth %d\n", p_vout->i_screen_depth );
- break;
-#endif
- }
-
/*
* Set pointers and build YUV tables
*/
if( p_vout->b_grayscale )
{
/* Grayscale: build gray table */
- switch( p_vout->i_screen_depth )
+ switch( p_vout->i_bytes_per_pixel )
{
- case 8:
+ case 1:
p_vout->yuv.yuv.p_gray8 = (u8 *)p_vout->yuv.p_base + GRAY_MARGIN;
+ for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+ {
+ p_vout->yuv.yuv.p_gray8[ -i_index ] = RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+ p_vout->yuv.yuv.p_gray8[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+ }
+ for( i_index = 0; i_index < 256; i_index++)
+ {
+ p_vout->yuv.yuv.p_gray8[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
+ }
break;
- case 15:
- case 16:
+ case 2:
p_vout->yuv.yuv.p_gray16 = (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
{
- p_vout->yuv.yuv.p_gray16[ -i_index ] =
- ((pi_gamma[ 0 ] >> i_red_right) << i_red_left) |
- ((pi_gamma[ 0 ] >> i_green_right) << i_green_left) |
- ((pi_gamma[ 0 ] >> i_blue_right) << i_blue_left);
- p_vout->yuv.yuv.p_gray16[ 256 + i_index ] =
- ((pi_gamma[ 255 ] >> i_red_right) << i_red_left) |
- ((pi_gamma[ 255 ] >> i_green_right) << i_green_left) |
- ((pi_gamma[ 255 ] >> i_blue_right) << i_blue_left);
+ p_vout->yuv.yuv.p_gray16[ -i_index ] = RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+ p_vout->yuv.yuv.p_gray16[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++)
{
- p_vout->yuv.yuv.p_gray16[ i_index ] =
- ((pi_gamma[ i_index ] >> i_red_right) << i_red_left) |
- ((pi_gamma[ i_index ] >> i_green_right) << i_green_left) |
- ((pi_gamma[ i_index ] >> i_blue_right) << i_blue_left);
+ p_vout->yuv.yuv.p_gray16[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
}
break;
- case 24:
- case 32:
+ case 3:
+ case 4:
p_vout->yuv.yuv.p_gray32 = (u32 *)p_vout->yuv.p_base + GRAY_MARGIN;
for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
{
- p_vout->yuv.yuv.p_gray32[ -i_index ] =
- ((pi_gamma[ 0 ] >> i_red_right) << i_red_left) |
- ((pi_gamma[ 0 ] >> i_green_right) << i_green_left) |
- ((pi_gamma[ 0 ] >> i_blue_right) << i_blue_left);
- p_vout->yuv.yuv.p_gray32[ 256 + i_index ] =
- ((pi_gamma[ 255 ] >> i_red_right) << i_red_left) |
- ((pi_gamma[ 255 ] >> i_green_right) << i_green_left) |
- ((pi_gamma[ 255 ] >> i_blue_right) << i_blue_left);
+ p_vout->yuv.yuv.p_gray32[ -i_index ] = RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+ p_vout->yuv.yuv.p_gray32[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++)
{
- p_vout->yuv.yuv.p_gray32[ i_index ] =
- ((pi_gamma[ i_index ] >> i_red_right) << i_red_left) |
- ((pi_gamma[ i_index ] >> i_green_right) << i_green_left) |
- ((pi_gamma[ i_index ] >> i_blue_right) << i_blue_left);
+ p_vout->yuv.yuv.p_gray32[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
}
break;
}
else
{
/* Color: build red, green and blue tables */
- switch( p_vout->i_screen_depth )
+ switch( p_vout->i_bytes_per_pixel )
{
- case 8:
+ case 1:
p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
+ for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+ {
+ p_vout->yuv.yuv.p_rgb8[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+ p_vout->yuv.yuv.p_rgb8[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+ }
+ for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+ {
+ p_vout->yuv.yuv.p_rgb8[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+ p_vout->yuv.yuv.p_rgb8[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+ }
+ for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+ {
+ p_vout->yuv.yuv.p_rgb8[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+ p_vout->yuv.yuv.p_rgb8[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+ }
+ for( i_index = 0; i_index < 256; i_index++ )
+ {
+ p_vout->yuv.yuv.p_rgb8[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+ p_vout->yuv.yuv.p_rgb8[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+ p_vout->yuv.yuv.p_rgb8[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+ }
break;
- case 15:
- case 16:
+ case 2:
p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
for( i_index = 0; i_index < RED_MARGIN; i_index++ )
{
- p_vout->yuv.yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = (pi_gamma[0]>>i_red_right)<<i_red_left;
- p_vout->yuv.yuv.p_rgb16[RED_OFFSET + 256 + i_index] = (pi_gamma[255]>>i_red_right)<<i_red_left;
+ p_vout->yuv.yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+ p_vout->yuv.yuv.p_rgb16[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
}
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 + 256 + i_index] = (pi_gamma[255]>>i_green_right)<<i_green_left;
+ p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+ p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
- p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = (pi_gamma[0]>>i_blue_right)<<i_blue_left;
- p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = (pi_gamma[255]>>i_blue_right)<<i_blue_left;
+ p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+ p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++ )
{
- p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] = (pi_gamma[i_index]>>i_red_right)<<i_red_left;
- p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = (pi_gamma[i_index]>>i_green_right)<<i_green_left;
- p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] = (pi_gamma[i_index]>>i_blue_right)<<i_blue_left;
+ p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+ p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+ p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
}
break;
- case 24:
- case 32:
+ case 3:
+ case 4:
p_vout->yuv.yuv.p_rgb32 = (u32 *)p_vout->yuv.p_base;
for( i_index = 0; i_index < RED_MARGIN; i_index++ )
{
- p_vout->yuv.yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = (pi_gamma[0]>>i_red_right)<<i_red_left;
- p_vout->yuv.yuv.p_rgb32[RED_OFFSET + 256 + i_index] = (pi_gamma[255]>>i_red_right)<<i_red_left;
+ p_vout->yuv.yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+ p_vout->yuv.yuv.p_rgb32[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
}
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
- p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = (pi_gamma[0]>>i_green_right)<<i_green_left;
- p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] = (pi_gamma[255]>>i_green_right)<<i_green_left;
+ p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+ p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
- p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = (pi_gamma[0]>>i_blue_right)<<i_blue_left;
- p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = (pi_gamma[255]>>i_blue_right)<<i_blue_left;
+ p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+ p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++ )
{
- p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] = (pi_gamma[i_index]>>i_red_right)<<i_red_left;
- p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = (pi_gamma[i_index]>>i_green_right)<<i_green_left;
- p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] = (pi_gamma[i_index]>>i_blue_right)<<i_blue_left;
+ p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+ p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+ p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
}
break;
}
if( p_vout->b_grayscale )
{
/* Grayscale */
- switch( p_vout->i_screen_depth )
+ switch( p_vout->i_bytes_per_pixel )
{
- case 8:
+ case 1:
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:
+ case 2:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray16;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray16;
break;
- case 24:
+ case 3:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray24;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray24;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray24;
break;
- case 32:
+ case 4:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray32;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray32;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray32;
else
{
/* Color */
- switch( p_vout->i_screen_depth )
+ switch( p_vout->i_bytes_per_pixel )
{
- case 8:
+ case 1:
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:
+ case 2:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB16;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertYUV422RGB16;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertYUV444RGB16;
break;
- case 24:
+ case 3:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB24;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertYUV422RGB24;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertYUV444RGB24;
break;
- case 32:
+ case 4:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB32;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertYUV422RGB32;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertYUV444RGB32;
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(400);
+ SCALE_HEIGHT(400, 1);
}
}
/*****************************************************************************
- * ConvertY4Gray16: grayscale YUV 4:x:x to RGB 15 or 16 bpp
+ * ConvertY4Gray16: grayscale YUV 4:x:x to RGB 2 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,
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(400);
+ SCALE_HEIGHT(400, 2);
}
}
/*****************************************************************************
- * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 24 bpp
+ * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 3 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,
}
/*****************************************************************************
- * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 32 bpp
+ * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 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,
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(400);
+ SCALE_HEIGHT(400, 4);
}
}
* 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;
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(420);
+ SCALE_HEIGHT(420, 1);
}
}
* 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;
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_Y_PIXEL(1);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(422);
+ SCALE_HEIGHT(422, 1);
}
}
* 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;
+ CONVERT_YUV_PIXEL(1); CONVERT_YUV_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_YUV_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_YUV_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_YUV_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_YUV_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_YUV_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_YUV_PIXEL(1);
+ CONVERT_YUV_PIXEL(1); CONVERT_YUV_PIXEL(1);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(444);
+ SCALE_HEIGHT(444, 1);
}
}
/*****************************************************************************
- * ConvertYUV420RGB16: color YUV 4:2:0 to RGB 15 or 16 bpp
+ * ConvertYUV420RGB16: color YUV 4:2:0 to RGB 2 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,
* 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;
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(420);
+ SCALE_HEIGHT(420, 2);
}
}
/*****************************************************************************
- * ConvertYUV422RGB16: color YUV 4:2:2 to RGB 15 or 16 bpp
+ * ConvertYUV422RGB16: color YUV 4:2:2 to RGB 2 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,
* 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;
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_Y_PIXEL(2);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(422);
+ SCALE_HEIGHT(422, 2);
}
}
/*****************************************************************************
- * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 15 or 16 bpp
+ * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 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,
* 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;
+ CONVERT_YUV_PIXEL(2); CONVERT_YUV_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_YUV_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_YUV_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_YUV_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_YUV_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_YUV_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_YUV_PIXEL(2);
+ CONVERT_YUV_PIXEL(2); CONVERT_YUV_PIXEL(2);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(444);
+ SCALE_HEIGHT(444, 2);
}
}
/*****************************************************************************
- * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 24 bpp
+ * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 3 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,
}
/*****************************************************************************
- * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 24 bpp
+ * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 3 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,
}
/*****************************************************************************
- * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 24 bpp
+ * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 3 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,
}
/*****************************************************************************
- * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 32 bpp
+ * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 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,
* 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;
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(420);
+ SCALE_HEIGHT(420, 4);
}
}
/*****************************************************************************
- * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 32 bpp
+ * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 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,
* 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;
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(422);
+ SCALE_HEIGHT(422, 4);
}
}
/*****************************************************************************
- * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 32 bpp
+ * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 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,
* 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;
+ CONVERT_YUV_PIXEL(4); CONVERT_YUV_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_YUV_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_YUV_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_YUV_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_YUV_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_YUV_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_YUV_PIXEL(4);
+ CONVERT_YUV_PIXEL(4); CONVERT_YUV_PIXEL(4);
}
/* Do horizontal and vertical scaling */
SCALE_WIDTH;
- SCALE_HEIGHT(444);
+ SCALE_HEIGHT(444, 4);
}
}
*/
#if 0
+//??
static void yuvToRgb24 (unsigned char * Y,
unsigned char * U, unsigned char * V,
char * dest, int table[1935], int width)