xine-lib  1.2.9
Data Structures | Macros | Enumerations | Functions | Variables
color.c File Reference
#include <xine/xine_internal.h>
#include "xine_mmx.h"

Data Structures

struct  rgb2yuy2_t
 

Macros

#define C_YUV420_YUYV_PROGRESSIVE(p_y1, p_y2, p_u, p_ut, p_ub, p_v, p_vt, p_vb, p_line1, p_line2)
 
#define C_YUV420_YUYV_INTERLACED(p_y1, p_y2, p_u, p_ut, p_ub, p_v, p_vt, p_vb, p_line1, p_line2)
 
#define C_YUYV_YUV420()
 
#define KB   0.114
 
#define KR   0.299
 
#define YR   (219.0/255.0)*KR*SCALEFACTOR
 
#define YG   (219.0/255.0)*(1.0-KB-KR)*SCALEFACTOR
 
#define YB   (219.0/255.0)*KB*SCALEFACTOR
 
#define UR   (112.0/255.0)*(KR/(KB-1.0))*SCALEFACTOR
 
#define UG   (112.0/255.0)*((1.0-KB-KR)/(KB-1.0))*SCALEFACTOR
 
#define UB   (112.0/255.0)*SCALEFACTOR
 
#define VR   (112.0/255.0)*SCALEFACTOR
 
#define VG   (112.0/255.0)*((1.0-KB-KR)/(KR-1.0))*SCALEFACTOR
 
#define VB   (112.0/255.0)*(KB/(KR-1.0))*SCALEFACTOR
 

Enumerations

enum  rgb_fmt_t {
  rgb_bgr = 0, rgb_rgb, rgb_bgra, rgb_argb,
  rgb_rgba, rgb_rgb555le, rgb_rgb555be, rgb_rgb565le,
  rgb_rgb565be, rgb_bgra_clut, rgb_rgba_clut, rgb_pal8,
  rgb_pal4, rgb_pal2, rgb_pal1
}
 

Functions

void init_yuv_planes (yuv_planes_t *yuv_planes, int width, int height)
 
void free_yuv_planes (yuv_planes_t *yuv_planes)
 
static void yuv444_to_yuy2_c (const yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch)
 
static void hscale_chroma_line (unsigned char *dst, const unsigned char *src, int width)
 
static void vscale_chroma_line (unsigned char *dst, int pitch, const unsigned char *src1, const unsigned char *src2, int width)
 
static void upsample_c_plane_c (const unsigned char *src, int src_width, int src_height, unsigned char *dest, unsigned int src_pitch, unsigned int dest_pitch)
 
static void yuv9_to_yv12_c (const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height)
 
static void yuv411_to_yv12_c (const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height)
 
static void yv12_to_yuy2_c (const unsigned char *y_src, int y_src_pitch, const unsigned char *u_src, int u_src_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *yuy2_map, int yuy2_pitch, int width, int height, int progressive)
 
static void yuy2_to_yv12_c (const unsigned char *yuy2_map, int yuy2_pitch, unsigned char *y_dst, int y_dst_pitch, unsigned char *u_dst, int u_dst_pitch, unsigned char *v_dst, int v_dst_pitch, int width, int height)
 
void init_yuv_conversion (void)
 
void * rgb2yuy2_alloc (int color_matrix, const char *format)
 
void rgb2yuy2_free (void *rgb2yuy2)
 
void rgb2yuy2_palette (void *rgb2yuy2, const uint8_t *pal, int num_colors, int bits_per_pixel)
 
void rgb2yuy2_slice (void *rgb2yuy2, const uint8_t *in, int ipitch, uint8_t *out, int opitch, int width, int height)
 

Variables

int y_r_table [256]
 
int y_g_table [256]
 
int y_b_table [256]
 
int uv_br_table [256]
 
int u_r_table [256]
 
int u_g_table [256]
 
int v_b_table [256]
 
int v_g_table [256]
 
int u_b_table [256]
 
int v_r_table [256]
 
void(* yuv444_to_yuy2 )(const yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch)
 
void(* yuv9_to_yv12 )(const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height)
 
void(* yuv411_to_yv12 )(const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height)
 
void(* yv12_to_yuy2 )(const unsigned char *y_src, int y_src_pitch, const unsigned char *u_src, int u_src_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *yuy2_map, int yuy2_pitch, int width, int height, int progressive)
 
void(* yuy2_to_yv12 )(const unsigned char *yuy2_map, int yuy2_pitch, unsigned char *y_dst, int y_dst_pitch, unsigned char *u_dst, int u_dst_pitch, unsigned char *v_dst, int v_dst_pitch, int width, int height)
 

Macro Definition Documentation

◆ C_YUV420_YUYV_INTERLACED

#define C_YUV420_YUYV_INTERLACED (   p_y1,
  p_y2,
  p_u,
  p_ut,
  p_ub,
  p_v,
  p_vt,
  p_vb,
  p_line1,
  p_line2 
)
Value:
*p_line1++ = *p_y1++; *p_line2++ = *p_y2++; \
*p_line1++ = (*p_ut++ + *p_u * 7) >> 3; *p_line2++ = (*p_u++ * 5 + *p_ub++ * 3) >> 3; \
*p_line1++ = *p_y1++; *p_line2++ = *p_y2++; \
*p_line1++ = (*p_vt++ + *p_v * 7) >> 3; *p_line2++ = (*p_v++ * 5 + *p_vb++ * 3) >> 3; \

Referenced by yv12_to_yuy2_c().

◆ C_YUV420_YUYV_PROGRESSIVE

#define C_YUV420_YUYV_PROGRESSIVE (   p_y1,
  p_y2,
  p_u,
  p_ut,
  p_ub,
  p_v,
  p_vt,
  p_vb,
  p_line1,
  p_line2 
)
Value:
utmp = 3 * *p_u++; \
vtmp = 3 * *p_v++; \
*p_line1++ = *p_y1++; *p_line2++ = *p_y2++; \
*p_line1++ = (*p_ut++ + utmp) >> 2; *p_line2++ = (utmp + *p_ub++) >> 2; \
*p_line1++ = *p_y1++; *p_line2++ = *p_y2++; \
*p_line1++ = (*p_vt++ + vtmp) >> 2; *p_line2++ = (vtmp + *p_vb++) >> 2; \

Referenced by yv12_to_yuy2_c().

◆ C_YUYV_YUV420

#define C_YUYV_YUV420 ( )
Value:
*p_y1++ = *p_line1++; *p_y2++ = *p_line2++; \
*p_u++ = (*p_line1++ + *p_line2++)>>1; \
*p_y1++ = *p_line1++; *p_y2++ = *p_line2++; \
*p_v++ = (*p_line1++ + *p_line2++)>>1;

Referenced by yuy2_to_yv12_c().

◆ KB

#define KB   0.114

◆ KR

#define KR   0.299

◆ UB

#define UB   (112.0/255.0)*SCALEFACTOR

Referenced by init_yuv_conversion().

◆ UG

#define UG   (112.0/255.0)*((1.0-KB-KR)/(KB-1.0))*SCALEFACTOR

Referenced by init_yuv_conversion().

◆ UR

#define UR   (112.0/255.0)*(KR/(KB-1.0))*SCALEFACTOR

Referenced by init_yuv_conversion().

◆ VB

#define VB   (112.0/255.0)*(KB/(KR-1.0))*SCALEFACTOR

Referenced by init_yuv_conversion().

◆ VG

#define VG   (112.0/255.0)*((1.0-KB-KR)/(KR-1.0))*SCALEFACTOR

Referenced by init_yuv_conversion().

◆ VR

#define VR   (112.0/255.0)*SCALEFACTOR

Referenced by init_yuv_conversion().

◆ YB

#define YB   (219.0/255.0)*KB*SCALEFACTOR

Referenced by init_yuv_conversion().

◆ YG

#define YG   (219.0/255.0)*(1.0-KB-KR)*SCALEFACTOR

Referenced by init_yuv_conversion().

◆ YR

#define YR   (219.0/255.0)*KR*SCALEFACTOR

Referenced by init_yuv_conversion().

Enumeration Type Documentation

◆ rgb_fmt_t

enum rgb_fmt_t
Enumerator
rgb_bgr 
rgb_rgb 
rgb_bgra 
rgb_argb 
rgb_rgba 
rgb_rgb555le 
rgb_rgb555be 
rgb_rgb565le 
rgb_rgb565be 
rgb_bgra_clut 
rgb_rgba_clut 
rgb_pal8 
rgb_pal4 
rgb_pal2 
rgb_pal1 

Function Documentation

◆ free_yuv_planes()

void free_yuv_planes ( yuv_planes_t yuv_planes)

◆ hscale_chroma_line()

static void hscale_chroma_line ( unsigned char *  dst,
const unsigned char *  src,
int  width 
)
static

References width.

Referenced by upsample_c_plane_c().

◆ init_yuv_conversion()

void init_yuv_conversion ( void  )

◆ init_yuv_planes()

void init_yuv_planes ( yuv_planes_t yuv_planes,
int  width,
int  height 
)

◆ rgb2yuy2_alloc()

void* rgb2yuy2_alloc ( int  color_matrix,
const char *  format 
)

◆ rgb2yuy2_free()

void rgb2yuy2_free ( void *  rgb2yuy2)

◆ rgb2yuy2_palette()

void rgb2yuy2_palette ( void *  rgb2yuy2,
const uint8_t *  pal,
int  num_colors,
int  bits_per_pixel 
)

◆ rgb2yuy2_slice()

void rgb2yuy2_slice ( void *  rgb2yuy2,
const uint8_t *  in,
int  ipitch,
uint8_t *  out,
int  opitch,
int  width,
int  height 
)

◆ upsample_c_plane_c()

static void upsample_c_plane_c ( const unsigned char *  src,
int  src_width,
int  src_height,
unsigned char *  dest,
unsigned int  src_pitch,
unsigned int  dest_pitch 
)
static

◆ vscale_chroma_line()

static void vscale_chroma_line ( unsigned char *  dst,
int  pitch,
const unsigned char *  src1,
const unsigned char *  src2,
int  width 
)
static

References width.

Referenced by upsample_c_plane_c().

◆ yuv411_to_yv12_c()

static void yuv411_to_yv12_c ( const unsigned char *  y_src,
int  y_src_pitch,
unsigned char *  y_dest,
int  y_dest_pitch,
const unsigned char *  u_src,
int  u_src_pitch,
unsigned char *  u_dest,
int  u_dest_pitch,
const unsigned char *  v_src,
int  v_src_pitch,
unsigned char *  v_dest,
int  v_dest_pitch,
int  width,
int  height 
)
static

References height, width, and xine_fast_memcpy.

Referenced by init_yuv_conversion().

◆ yuv444_to_yuy2_c()

static void yuv444_to_yuy2_c ( const yuv_planes_t yuv_planes,
unsigned char *  yuy2_map,
int  pitch 
)
static

◆ yuv9_to_yv12_c()

static void yuv9_to_yv12_c ( const unsigned char *  y_src,
int  y_src_pitch,
unsigned char *  y_dest,
int  y_dest_pitch,
const unsigned char *  u_src,
int  u_src_pitch,
unsigned char *  u_dest,
int  u_dest_pitch,
const unsigned char *  v_src,
int  v_src_pitch,
unsigned char *  v_dest,
int  v_dest_pitch,
int  width,
int  height 
)
static

◆ yuy2_to_yv12_c()

static void yuy2_to_yv12_c ( const unsigned char *  yuy2_map,
int  yuy2_pitch,
unsigned char *  y_dst,
int  y_dst_pitch,
unsigned char *  u_dst,
int  u_dst_pitch,
unsigned char *  v_dst,
int  v_dst_pitch,
int  width,
int  height 
)
static

References C_YUYV_YUV420, height, and width.

Referenced by init_yuv_conversion().

◆ yv12_to_yuy2_c()

static void yv12_to_yuy2_c ( const unsigned char *  y_src,
int  y_src_pitch,
const unsigned char *  u_src,
int  u_src_pitch,
const unsigned char *  v_src,
int  v_src_pitch,
unsigned char *  yuy2_map,
int  yuy2_pitch,
int  width,
int  height,
int  progressive 
)
static

Variable Documentation

◆ u_b_table

int u_b_table[256]

Referenced by init_yuv_conversion().

◆ u_g_table

int u_g_table[256]

Referenced by init_yuv_conversion().

◆ u_r_table

int u_r_table[256]

Referenced by init_yuv_conversion().

◆ uv_br_table

int uv_br_table[256]

Referenced by init_yuv_conversion().

◆ v_b_table

int v_b_table[256]

Referenced by init_yuv_conversion().

◆ v_g_table

int v_g_table[256]

Referenced by init_yuv_conversion().

◆ v_r_table

int v_r_table[256]

Referenced by init_yuv_conversion().

◆ y_b_table

int y_b_table[256]

Referenced by init_yuv_conversion().

◆ y_g_table

int y_g_table[256]

Referenced by init_yuv_conversion().

◆ y_r_table

int y_r_table[256]

Referenced by init_yuv_conversion().

◆ yuv411_to_yv12

void(* yuv411_to_yv12) (const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height)

◆ yuv444_to_yuy2

void(* yuv444_to_yuy2) (const yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch)

◆ yuv9_to_yv12

void(* yuv9_to_yv12) (const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height)

◆ yuy2_to_yv12

void(* yuy2_to_yv12) (const unsigned char *yuy2_map, int yuy2_pitch, unsigned char *y_dst, int y_dst_pitch, unsigned char *u_dst, int u_dst_pitch, unsigned char *v_dst, int v_dst_pitch, int width, int height)

◆ yv12_to_yuy2

void(* yv12_to_yuy2) (const unsigned char *y_src, int y_src_pitch, const unsigned char *u_src, int u_src_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *yuy2_map, int yuy2_pitch, int width, int height, int progressive)