xine-lib: xine-lib-1.2.12/src/xine-engine/alphablend.c File Reference

xine-lib 1.2.12

Macros | Functions
alphablend.c File Reference
`#include <string.h>`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <xine/xine_internal.h>`
`#include <xine/video_out.h>`
`#include <xine/alphablend.h>`
`#include "bswap.h"`

## Macros
#define | BLEND_COLOR(dst, src, mask, o) ((((((src&mask)-(dst&mask))*(o*0x111+1))>>12)+(dst&mask))&mask)
#define | BLEND_BYTE(dst, src, o) (((((src)-(dst))*(o*0x1111+1))>>16)+(dst))
#define | SCALE_SHIFT 16
#define | SCALE_FACTOR (1<<SCALE_SHIFT)
#define | INT_TO_SCALED(i) ((i) << SCALE_SHIFT)
#define | SCALED_TO_INT(sc) ((sc) >> SCALE_SHIFT)
#define | saturate(v) if (v & ~255) v = (~((uint32_t)v)) >> 24

## Functions
static void | mem_blend8 (uint8_t *mem, uint8_t val, uint8_t o, size_t sz)
static void | mem_blend16 (uint16_t *mem, uint16_t clr, uint8_t o, int len)
static void | mem_blend24 (uint8_t *mem, uint8_t r, uint8_t g, uint8_t b, uint8_t o, int len)
static void | mem_blend32 (uint8_t *mem, const uint8_t *src, uint8_t o, int len)
static rle_elem_t * | rle_img_advance_line (rle_elem_t *rle, rle_elem_t *rle_limit, int w)
void | _x_blend_rgb16 (uint8_t *img, vo_overlay_t *img_overl, int img_width, int img_height, int dst_width, int dst_height, alphablend_t *extra_data)
void | _x_blend_rgb24 (uint8_t *img, vo_overlay_t *img_overl, int img_width, int img_height, int dst_width, int dst_height, alphablend_t *extra_data)
void | _x_blend_rgb32 (uint8_t *img, vo_overlay_t *img_overl, int img_width, int img_height, int dst_width, int dst_height, alphablend_t *extra_data)
static void | blend_yuv_exact (uint8_t *dst_cr, uint8_t *dst_cb, int src_width, uint8_t *(*blend_yuv_data)[3][2])
static uint8_t *(* | blend_yuv_grow_extra_data (alphablend_t *extra_data, int osd_width))[3]
void | _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t *img_overl, int dst_width, int dst_height, int dst_pitches[3], alphablend_t *extra_data)
static void | blend_yuy2_exact (uint8_t *dst_cr, uint8_t *dst_cb, int src_width, uint8_t *(*blend_yuy2_data)[3])
static uint8_t *(* | blend_yuy2_grow_extra_data (alphablend_t *extra_data, int osd_width))[3]
void | _x_blend_yuy2 (uint8_t *dst_img, vo_overlay_t *img_overl, int dst_width, int dst_height, int dst_pitch, alphablend_t *extra_data)
void | _x_clear_xx44_palette (xx44_palette_t *p)
void | _x_init_xx44_palette (xx44_palette_t *p, unsigned num_entries)
void | _x_dispose_xx44_palette (xx44_palette_t *p)
static void | colorToPalette (const uint32_t *icolor, unsigned char *palette_p, unsigned num_xvmc_components, const char *xvmc_components)
void | _x_xx44_to_xvmc_palette (const xx44_palette_t *p, unsigned char *xvmc_palette, unsigned first_xx44_entry, unsigned num_xx44_entries, unsigned num_xvmc_components, const char *xvmc_components)
static int | xx44_paletteIndex (xx44_palette_t *p, int color, uint32_t clut)
static void | memblend_xx44 (uint8_t *mem, uint8_t val, register size_t size, uint8_t mask)
void | _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, int dst_width, int dst_height, int dst_pitch, alphablend_t *extra_data, xx44_palette_t *palette, int ia44)
static void | alphablend_disable_exact_osd_alpha_blending_changed (void *user_data, xine_cfg_entry_t *entry)
void | _x_alphablend_init (alphablend_t *extra_data, xine_t *xine)
void | _x_alphablend_free (alphablend_t *extra_data)
void | _x_clut_yuv2rgb (uint32_t *clut, int num_items, int color_matrix)

## Macro Definition Documentation

## ◆ BLEND_BYTE

#define BLEND_BYTE | ( |  | dst,
|  |  | src,
|  |  | o
| ) |  | (((((src)-(dst))*(o*0x1111+1))>>16)+(dst))

## ◆ BLEND_COLOR

#define BLEND_COLOR | ( |  | dst,
|  |  | src,
|  |  | mask,
|  |  | o
| ) |  | ((((((src&mask)-(dst&mask))*(o*0x111+1))>>12)+(dst&mask))&mask)

## ◆ INT_TO_SCALED

#define INT_TO_SCALED | ( |  | i | ) | ((i) << SCALE_SHIFT)

## ◆ saturate

#define saturate | ( |  | v | ) | if (v & ~255) v = (~((uint32_t)v)) >> 24

## ◆ SCALE_FACTOR

#define SCALE_FACTOR (1<<SCALE_SHIFT)

## ◆ SCALE_SHIFT

#define SCALE_SHIFT 16

## ◆ SCALED_TO_INT

#define SCALED_TO_INT | ( |  | sc | ) | ((sc) >> SCALE_SHIFT)

## Function Documentation

## ◆ _x_alphablend_free()

void _x_alphablend_free | ( | alphablend_t * | extra_data | ) |

References _x_freep(), alphablend_t::buffer, and alphablend_t::buffer_size.

Referenced by Destroy(), directfb_dispose(), dxr3_dispose(), fb_dispose(), macosx_dispose(), mmal_dispose(), opengl_dispose_internal(), pgx32_dispose(), pgx64_dispose(), sdl_dispose(), stk_dispose(), vidix_exit(), xshm_dispose(), xv_dispose(), and xxmc_dispose().

## ◆ _x_alphablend_init()

void _x_alphablend_init | ( | alphablend_t * | extra_data,
|  | xine_t * | xine
| ) |  |

References _, alphablend_disable_exact_osd_alpha_blending_changed(), alphablend_t::buffer, alphablend_t::buffer_size, xine_s::config, alphablend_t::disable_exact_blending, NULL, alphablend_t::offset_x, alphablend_t::offset_y, and config_values_s::register_bool.

Referenced by dxr3_vo_open_plugin(), fb_open_plugin(), open_plugin(), open_plugin_2(), open_plugin_fb(), opengl_open_plugin(), pgx32_init_driver(), pgx64_init_driver(), xshm_open_plugin(), and xshm_open_plugin_2().

## ◆ _x_blend_rgb16()

void _x_blend_rgb16 | ( | uint8_t * | img,
|  | vo_overlay_t * | img_overl,
|  | int | img_width,
|  | int | img_height,
|  | int | dst_width,
|  | int | dst_height,
|  | alphablend_t * | extra_data
| ) |  |

References rle_elem_s::color, vo_overlay_s::color, vo_overlay_s::height, vo_overlay_s::hili_bottom, vo_overlay_s::hili_color, vo_overlay_s::hili_left, vo_overlay_s::hili_right, vo_overlay_s::hili_top, vo_overlay_s::hili_trans, INT_TO_SCALED, rle_elem_s::len, mem_blend16(), vo_overlay_s::num_rle, alphablend_t::offset_x, alphablend_t::offset_y, vo_overlay_s::rle, rle_img_advance_line(), SCALED_TO_INT, vo_overlay_s::trans, vo_overlay_s::width, vo_overlay_s::x, and vo_overlay_s::y.

Referenced by fb_overlay_blend(), and xshm_overlay_blend().

## ◆ _x_blend_rgb24()

void _x_blend_rgb24 | ( | uint8_t * | img,
|  | vo_overlay_t * | img_overl,
|  | int | img_width,
|  | int | img_height,
|  | int | dst_width,
|  | int | dst_height,
|  | alphablend_t * | extra_data
| ) |  |

References rle_elem_s::color, vo_overlay_s::color, vo_overlay_s::height, vo_overlay_s::hili_bottom, vo_overlay_s::hili_color, vo_overlay_s::hili_left, vo_overlay_s::hili_right, vo_overlay_s::hili_top, vo_overlay_s::hili_trans, INT_TO_SCALED, rle_elem_s::len, mem_blend24(), vo_overlay_s::num_rle, alphablend_t::offset_x, alphablend_t::offset_y, vo_overlay_s::rle, rle_img_advance_line(), SCALED_TO_INT, vo_overlay_s::trans, vo_overlay_s::width, vo_overlay_s::x, and vo_overlay_s::y.

Referenced by fb_overlay_blend(), opengl_overlay_blend(), and xshm_overlay_blend().

## ◆ _x_blend_rgb32()

void _x_blend_rgb32 | ( | uint8_t * | img,
|  | vo_overlay_t * | img_overl,
|  | int | img_width,
|  | int | img_height,
|  | int | dst_width,
|  | int | dst_height,
|  | alphablend_t * | extra_data
| ) |  |

References rle_elem_s::color, vo_overlay_s::color, vo_overlay_s::height, vo_overlay_s::hili_bottom, vo_overlay_s::hili_color, vo_overlay_s::hili_left, vo_overlay_s::hili_right, vo_overlay_s::hili_top, vo_overlay_s::hili_trans, INT_TO_SCALED, rle_elem_s::len, mem_blend32(), vo_overlay_s::num_rle, alphablend_t::offset_x, alphablend_t::offset_y, vo_overlay_s::rle, rle_img_advance_line(), SCALED_TO_INT, vo_overlay_s::trans, vo_overlay_s::width, vo_overlay_s::x, and vo_overlay_s::y.

Referenced by fb_overlay_blend(), opengl_overlay_blend(), and xshm_overlay_blend().

## ◆ _x_blend_xx44()

void _x_blend_xx44 | ( | uint8_t * | dst_img,
|  | vo_overlay_t * | img_overl,
|  | int | dst_width,
|  | int | dst_height,
|  | int | dst_pitch,
|  | alphablend_t * | extra_data,
|  | xx44_palette_t * | palette,
|  | int | ia44
| ) |  |

References rle_elem_s::color, vo_overlay_s::color, vo_overlay_s::height, vo_overlay_s::hili_bottom, vo_overlay_s::hili_color, vo_overlay_s::hili_left, vo_overlay_s::hili_right, vo_overlay_s::hili_top, vo_overlay_s::hili_trans, rle_elem_s::len, memblend_xx44(), vo_overlay_s::num_rle, alphablend_t::offset_x, alphablend_t::offset_y, OVL_PALETTE_SIZE, vo_overlay_s::rle, vo_overlay_s::trans, vo_overlay_s::width, vo_overlay_s::x, xx44_paletteIndex(), and vo_overlay_s::y.

Referenced by xxmc_overlay_blend().

## ◆ _x_blend_yuv()

void _x_blend_yuv | ( | uint8_t * | dst_base[3],
|  | vo_overlay_t * | img_overl,
|  | int | dst_width,
|  | int | dst_height,
|  | int | dst_pitches[3],
|  | alphablend_t * | extra_data
| ) |  |

References blend_yuv_exact(), blend_yuv_grow_extra_data(), rle_elem_s::color, vo_overlay_s::color, alphablend_t::disable_exact_blending, vo_overlay_s::height, vo_overlay_s::hili_bottom, vo_overlay_s::hili_color, vo_overlay_s::hili_left, vo_overlay_s::hili_right, vo_overlay_s::hili_top, vo_overlay_s::hili_trans, rle_elem_s::len, mem_blend8(), vo_overlay_s::num_rle, alphablend_t::offset_x, alphablend_t::offset_y, vo_overlay_s::rle, vo_overlay_s::trans, vo_overlay_s::width, vo_overlay_s::x, and vo_overlay_s::y.

Referenced by directfb_overlay_blend(), dxr3_overlay_blend(), macosx_overlay_blend(), mmal_overlay_blend(), opengl_overlay_blend(), pgx64_overlay_blend(), sdl_overlay_blend(), stk_overlay_blend(), vidix_overlay_blend(), win32_overlay_blend(), xv_overlay_blend(), and xxmc_overlay_blend().

## ◆ _x_blend_yuy2()

void _x_blend_yuy2 | ( | uint8_t * | dst_img,
|  | vo_overlay_t * | img_overl,
|  | int | dst_width,
|  | int | dst_height,
|  | int | dst_pitch,
|  | alphablend_t * | extra_data
| ) |  |

References BLEND_BYTE, blend_yuy2_exact(), blend_yuy2_grow_extra_data(), rle_elem_s::color, vo_overlay_s::color, alphablend_t::disable_exact_blending, vo_overlay_s::height, vo_overlay_s::hili_bottom, vo_overlay_s::hili_color, vo_overlay_s::hili_left, vo_overlay_s::hili_right, vo_overlay_s::hili_top, vo_overlay_s::hili_trans, rle_elem_s::len, mem_blend32(), vo_overlay_s::num_rle, alphablend_t::offset_x, alphablend_t::offset_y, vo_overlay_s::rle, vo_overlay_s::trans, vo_overlay_s::width, vo_overlay_s::x, clut_s::y, and vo_overlay_s::y.

Referenced by directfb_overlay_blend(), dxr3_overlay_blend(), macosx_overlay_blend(), mmal_overlay_blend(), opengl_overlay_blend(), pgx64_overlay_blend(), sdl_overlay_blend(), stk_overlay_blend(), vidix_overlay_blend(), win32_overlay_blend(), xv_overlay_blend(), and xxmc_overlay_blend().

## ◆ _x_clear_xx44_palette()

void _x_clear_xx44_palette | ( | xx44_palette_t * | p | ) |

References xx44_palette_t::cluts, xx44_palette_t::lookup_cache, xx44_palette_t::max_used, OVL_PALETTE_SIZE, and xx44_palette_t::size.

Referenced by xxmc_overlay_begin().

## ◆ _x_clut_yuv2rgb()

void _x_clut_yuv2rgb | ( | uint32_t * | clut,
|  | int | num_items,
|  | int | color_matrix
| ) |  |

References saturate, and v.

Referenced by _x_overlay_clut_yuv2rgb().

## ◆ _x_dispose_xx44_palette()

void _x_dispose_xx44_palette | ( | xx44_palette_t * | p | ) |

Referenced by xxmc_dispose_context().

## ◆ _x_init_xx44_palette()

void _x_init_xx44_palette | ( | xx44_palette_t * | p,
|  | unsigned | num_entries
| ) |  |

References xx44_palette_t::size, and XX44_PALETTE_SIZE.

Referenced by checkXvMCCap(), and xxmc_setup_subpictures().

## ◆ _x_xx44_to_xvmc_palette()

void _x_xx44_to_xvmc_palette | ( | const xx44_palette_t * | p,
|  | unsigned char * | xvmc_palette,
|  | unsigned | first_xx44_entry,
|  | unsigned | num_xx44_entries,
|  | unsigned | num_xvmc_components,
|  | const char * | xvmc_components
| ) |  |

References xx44_palette_t::cluts, colorToPalette(), and xx44_palette_t::size.

Referenced by xxmc_overlay_end().

## ◆ alphablend_disable_exact_osd_alpha_blending_changed()

static void alphablend_disable_exact_osd_alpha_blending_changed | ( | void * | user_data,
|  | xine_cfg_entry_t * | entry
| ) |  |
| static

References alphablend_t::disable_exact_blending, xine_cfg_entry_s::num_value, and user_data().

Referenced by _x_alphablend_init().

## ◆ blend_yuv_exact()

static void blend_yuv_exact | ( | uint8_t * | dst_cr,
|  | uint8_t * | dst_cb,
|  | int | src_width,
|  | uint8_t *(*) | blend_yuv_data[3][2]
| ) |  |
| static

Referenced by _x_blend_yuv().

## ◆ blend_yuv_grow_extra_data()

static uint8_t *(* blend_yuv_grow_extra_data | ( | alphablend_t * | extra_data,
|  | int | osd_width
| ) |  | )[3]
| static

References _x_freep(), alphablend_t::buffer, alphablend_t::buffer_size, ME_FOURCC, and NULL.

Referenced by _x_blend_yuv().

## ◆ blend_yuy2_exact()

static void blend_yuy2_exact | ( | uint8_t * | dst_cr,
|  | uint8_t * | dst_cb,
|  | int | src_width,
|  | uint8_t *(*) | blend_yuy2_data[3]
| ) |  |
| static

Referenced by _x_blend_yuy2().

## ◆ blend_yuy2_grow_extra_data()

static uint8_t *(* blend_yuy2_grow_extra_data | ( | alphablend_t * | extra_data,
|  | int | osd_width
| ) |  | )[3]
| static

References _x_freep(), alphablend_t::buffer, alphablend_t::buffer_size, and ME_FOURCC.

Referenced by _x_blend_yuy2().

## ◆ colorToPalette()

static void colorToPalette | ( | const uint32_t * | icolor,
|  | unsigned char * | palette_p,
|  | unsigned | num_xvmc_components,
|  | const char * | xvmc_components
| ) |  |
| static

References clut_s::cb, clut_s::cr, and clut_s::y.

Referenced by _x_xx44_to_xvmc_palette().

## ◆ mem_blend16()

static void mem_blend16 | ( | uint16_t * | mem,
|  | uint16_t | clr,
|  | uint8_t | o,
|  | int | len
| ) |  |
| static

References BLEND_COLOR.

Referenced by _x_blend_rgb16().

## ◆ mem_blend24()

static void mem_blend24 | ( | uint8_t * | mem,
|  | uint8_t | r,
|  | uint8_t | g,
|  | uint8_t | b,
|  | uint8_t | o,
|  | int | len
| ) |  |
| static

References BLEND_BYTE.

Referenced by _x_blend_rgb24().

## ◆ mem_blend32()

static void mem_blend32 | ( | uint8_t * | mem,
|  | const uint8_t * | src,
|  | uint8_t | o,
|  | int | len
| ) |  |
| static

References BLEND_BYTE.

Referenced by _x_blend_rgb32(), and _x_blend_yuy2().

## ◆ mem_blend8()

static void mem_blend8 | ( | uint8_t * | mem,
|  | uint8_t | val,
|  | uint8_t | o,
|  | size_t | sz
| ) |  |
| static

References BLEND_BYTE.

Referenced by _x_blend_yuv().

## ◆ memblend_xx44()

static void memblend_xx44 | ( | uint8_t * | mem,
|  | uint8_t | val,
|  | register size_t | size,
|  | uint8_t | mask
| ) |  |
| static

Referenced by _x_blend_xx44().

## ◆ rle_img_advance_line()

static rle_elem_t * rle_img_advance_line | ( | rle_elem_t * | rle,
|  | rle_elem_t * | rle_limit,
|  | int | w
| ) |  |
| static

References rle_elem_s::len.

Referenced by _x_blend_rgb16(), _x_blend_rgb24(), and _x_blend_rgb32().

## ◆ xx44_paletteIndex()

static int xx44_paletteIndex | ( | xx44_palette_t * | p,
|  | int | color,
|  | uint32_t | clut
| ) |  |
| static

References xx44_palette_t::cluts, xx44_palette_t::lookup_cache, xx44_palette_t::max_used, and xx44_palette_t::size.

Referenced by _x_blend_xx44().