Diffstat (limited to 'noncore/multimedia/opieplayer2/alphablend.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/alphablend.h | 91 |
1 files changed, 84 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/alphablend.h b/noncore/multimedia/opieplayer2/alphablend.h index 7230f41..1edb5ba 100644 --- a/noncore/multimedia/opieplayer2/alphablend.h +++ b/noncore/multimedia/opieplayer2/alphablend.h | |||
@@ -24,34 +24,111 @@ | |||
24 | 24 | ||
25 | #ifndef __ALPHABLEND_H__ | 25 | #ifndef __ALPHABLEND_H__ |
26 | #define __ALPHABLEND_H__ | 26 | #define __ALPHABLEND_H__ |
27 | 27 | ||
28 | #include <xine/video_out.h> | 28 | #include <xine/video_out.h> |
29 | 29 | ||
30 | typedef struct { | ||
31 | void *buffer; | ||
32 | int buffer_size; | ||
33 | |||
34 | int disable_exact_blending; | ||
35 | } alphablend_t; | ||
36 | |||
37 | void _x_alphablend_init(alphablend_t *extra_data, xine_t *xine); | ||
38 | void _x_alphablend_free(alphablend_t *extra_data); | ||
39 | |||
40 | /* _MSC_VER port changes */ | ||
41 | #undef ATTRIBUTE_PACKED | ||
42 | #undef PRAGMA_PACK_BEGIN | ||
43 | #undef PRAGMA_PACK_END | ||
44 | |||
45 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined(__ICC) | ||
46 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
47 | #define PRAGMA_PACK 0 | ||
48 | #endif | ||
49 | |||
50 | #if !defined(ATTRIBUTE_PACKED) | ||
51 | #define ATTRIBUTE_PACKED | ||
52 | #define PRAGMA_PACK 1 | ||
53 | #endif | ||
54 | |||
55 | #if PRAGMA_PACK | ||
56 | #pragma pack(8) | ||
57 | #endif | ||
58 | |||
30 | typedef struct { /* CLUT == Color LookUp Table */ | 59 | typedef struct { /* CLUT == Color LookUp Table */ |
31 | uint8_t cb : 8; | 60 | uint8_t cb : 8; |
32 | uint8_t cr : 8; | 61 | uint8_t cr : 8; |
33 | uint8_t y : 8; | 62 | uint8_t y : 8; |
34 | uint8_t foo : 8; | 63 | uint8_t foo : 8; |
35 | } __attribute__ ((packed)) clut_t; | 64 | } ATTRIBUTE_PACKED clut_t; |
65 | |||
66 | |||
67 | #if PRAGMA_PACK | ||
68 | #pragma pack() | ||
69 | #endif | ||
70 | |||
71 | #define XX44_PALETTE_SIZE 32 | ||
72 | |||
73 | typedef struct { | ||
74 | unsigned size; | ||
75 | unsigned max_used; | ||
76 | uint32_t cluts[XX44_PALETTE_SIZE]; | ||
77 | /* cache palette entries for both colors and clip_colors */ | ||
78 | int lookup_cache[OVL_PALETTE_SIZE*2]; | ||
79 | } xx44_palette_t; | ||
80 | |||
36 | 81 | ||
37 | void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, | 82 | void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, |
38 | int img_width, int img_height, | 83 | int img_width, int img_height, |
39 | int dst_width, int dst_height); | 84 | int dst_width, int dst_height, |
85 | alphablend_t *extra_data); | ||
40 | 86 | ||
41 | void blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, | 87 | void blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, |
42 | int img_width, int img_height, | 88 | int img_width, int img_height, |
43 | int dst_width, int dst_height); | 89 | int dst_width, int dst_height, |
90 | alphablend_t *extra_data); | ||
44 | 91 | ||
45 | void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, | 92 | void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, |
46 | int img_width, int img_height, | 93 | int img_width, int img_height, |
47 | int dst_width, int dst_height); | 94 | int dst_width, int dst_height, |
95 | alphablend_t *extra_data); | ||
48 | 96 | ||
49 | void blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, | 97 | void blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, |
50 | int dst_width, int dst_height); | 98 | int dst_width, int dst_height, int dst_pitches[3], |
99 | alphablend_t *extra_data); | ||
51 | 100 | ||
52 | void blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, | 101 | void blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, |
53 | int dst_width, int dst_height); | 102 | int dst_width, int dst_height, int dst_pitch, |
103 | alphablend_t *extra_data); | ||
104 | |||
105 | /* | ||
106 | * This function isn't too smart about blending. We want to avoid creating new | ||
107 | * colors in the palette as a result from two non-zero colors needed to be | ||
108 | * blended. Instead we choose the color with the highest alpha value to be | ||
109 | * visible. Some parts of the code taken from the "VeXP" project. | ||
110 | */ | ||
111 | |||
112 | void blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, | ||
113 | int dst_width, int dst_height, int dst_pitch, | ||
114 | alphablend_t *extra_data, | ||
115 | xx44_palette_t *palette,int ia44); | ||
116 | |||
117 | /* | ||
118 | * Functions to handle the xine-specific palette. | ||
119 | */ | ||
120 | |||
121 | void clear_xx44_palette(xx44_palette_t *p); | ||
122 | void init_xx44_palette(xx44_palette_t *p, unsigned num_entries); | ||
123 | void dispose_xx44_palette(xx44_palette_t *p); | ||
124 | |||
125 | /* | ||
126 | * Convert the xine-specific palette to something useful. | ||
127 | */ | ||
128 | |||
129 | void xx44_to_xvmc_palette(const xx44_palette_t *p,unsigned char *xvmc_palette, | ||
130 | unsigned first_xx44_entry, unsigned num_xx44_entries, | ||
131 | unsigned num_xvmc_components, char *xvmc_components); | ||
54 | 132 | ||
55 | void crop_overlay (vo_overlay_t * overlay); | ||
56 | 133 | ||
57 | #endif | 134 | #endif |