author | zecke <zecke> | 2002-07-11 22:48:38 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-07-11 22:48:38 (UTC) |
commit | a7b8ef4096c17ba5e0ff96e9292a291390831e69 (patch) (unidiff) | |
tree | 94efad118c336e4d8c00137c7be5b31852c8296d /noncore/multimedia/opieplayer2/yuv2rgb.h | |
parent | d2c7228d2efe6f47ef5b7ec04157fcead775be74 (diff) | |
download | opie-a7b8ef4096c17ba5e0ff96e9292a291390831e69.zip opie-a7b8ef4096c17ba5e0ff96e9292a291390831e69.tar.gz opie-a7b8ef4096c17ba5e0ff96e9292a291390831e69.tar.bz2 |
add files
Diffstat (limited to 'noncore/multimedia/opieplayer2/yuv2rgb.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/yuv2rgb.h | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb.h b/noncore/multimedia/opieplayer2/yuv2rgb.h new file mode 100644 index 0000000..5b9c3f6 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/yuv2rgb.h | |||
@@ -0,0 +1,151 @@ | |||
1 | |||
2 | #ifndef HAVE_YUV2RGB_H | ||
3 | #define HAVE_YUV2RGB_h | ||
4 | |||
5 | #include <inttypes.h> | ||
6 | |||
7 | typedef struct yuv2rgb_s yuv2rgb_t; | ||
8 | |||
9 | typedef struct yuv2rgb_factory_s yuv2rgb_factory_t; | ||
10 | |||
11 | /* | ||
12 | * function types for functions which can be replaced | ||
13 | * by hardware-accelerated versions | ||
14 | */ | ||
15 | |||
16 | /* internal function use to scale yuv data */ | ||
17 | typedef void (*scale_line_func_t) (uint8_t *source, uint8_t *dest, int width, int step); | ||
18 | |||
19 | typedef void (*yuv2rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * py, uint8_t * pu, uint8_t * pv) ; | ||
20 | |||
21 | typedef void (*yuy22rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * p); | ||
22 | |||
23 | typedef uint32_t (*yuv2rgb_single_pixel_fun_t) (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v); | ||
24 | |||
25 | |||
26 | /* | ||
27 | * modes supported - feel free to implement yours | ||
28 | */ | ||
29 | |||
30 | #define MODE_8_RGB 1 | ||
31 | #define MODE_8_BGR 2 | ||
32 | #define MODE_15_RGB 3 | ||
33 | #define MODE_15_BGR 4 | ||
34 | #define MODE_16_RGB 5 | ||
35 | #define MODE_16_BGR 6 | ||
36 | #define MODE_24_RGB 7 | ||
37 | #define MODE_24_BGR 8 | ||
38 | #define MODE_32_RGB 9 | ||
39 | #define MODE_32_BGR 10 | ||
40 | #defineMODE_8_GRAY 11 | ||
41 | #define MODE_PALETTE 12 | ||
42 | |||
43 | struct yuv2rgb_s { | ||
44 | |||
45 | /* | ||
46 | * configure converter for scaling factors | ||
47 | */ | ||
48 | int (*configure) (yuv2rgb_t *this, | ||
49 | int source_width, int source_height, | ||
50 | int y_stride, int uv_stride, | ||
51 | int dest_width, int dest_height, | ||
52 | int rgb_stride); | ||
53 | |||
54 | /* | ||
55 | * this is the function to call for the yuv2rgb and scaling process | ||
56 | */ | ||
57 | yuv2rgb_fun_t yuv2rgb_fun; | ||
58 | |||
59 | /* | ||
60 | * this is the function to call for the yuy2->rgb and scaling process | ||
61 | */ | ||
62 | yuy22rgb_fun_t yuy22rgb_fun; | ||
63 | |||
64 | /* | ||
65 | * this is the function to call for the yuv2rgb for a single pixel | ||
66 | * (used for converting clut colors) | ||
67 | */ | ||
68 | |||
69 | yuv2rgb_single_pixel_fun_t yuv2rgb_single_pixel_fun; | ||
70 | |||
71 | /* private stuff below */ | ||
72 | |||
73 | int source_width, source_height; | ||
74 | int y_stride, uv_stride; | ||
75 | int dest_width, dest_height; | ||
76 | int rgb_stride; | ||
77 | int step_dx, step_dy; | ||
78 | int do_scale; | ||
79 | |||
80 | uint8_t *y_buffer; | ||
81 | uint8_t *u_buffer; | ||
82 | uint8_t *v_buffer; | ||
83 | void *y_chunk; | ||
84 | void *u_chunk; | ||
85 | void *v_chunk; | ||
86 | |||
87 | void **table_rV; | ||
88 | void **table_gU; | ||
89 | int *table_gV; | ||
90 | void **table_bU; | ||
91 | |||
92 | uint8_t *cmap; | ||
93 | scale_line_func_t scale_line; | ||
94 | |||
95 | } ; | ||
96 | |||
97 | /* | ||
98 | * convenience class to easily create a lot of converters | ||
99 | */ | ||
100 | |||
101 | struct yuv2rgb_factory_s { | ||
102 | |||
103 | yuv2rgb_t* (*create_converter) (yuv2rgb_factory_t *this); | ||
104 | |||
105 | /* | ||
106 | * adjust gamma (-100 to 100 looks fine) | ||
107 | * for all converters produced by this factory | ||
108 | */ | ||
109 | void (*set_gamma) (yuv2rgb_factory_t *this, int gamma); | ||
110 | |||
111 | /* | ||
112 | * get gamma value | ||
113 | */ | ||
114 | int (*get_gamma) (yuv2rgb_factory_t *this); | ||
115 | |||
116 | /* private data */ | ||
117 | |||
118 | int mode; | ||
119 | int swapped; | ||
120 | uint8_t *cmap; | ||
121 | |||
122 | int gamma; | ||
123 | int entry_size; | ||
124 | |||
125 | uint32_t matrix_coefficients; | ||
126 | |||
127 | void *table_rV[256]; | ||
128 | void *table_gU[256]; | ||
129 | int table_gV[256]; | ||
130 | void *table_bU[256]; | ||
131 | |||
132 | /* preselected functions for mode/swap/hardware */ | ||
133 | yuv2rgb_fun_t yuv2rgb_fun; | ||
134 | yuy22rgb_fun_t yuy22rgb_fun; | ||
135 | yuv2rgb_single_pixel_fun_t yuv2rgb_single_pixel_fun; | ||
136 | |||
137 | }; | ||
138 | |||
139 | yuv2rgb_factory_t *yuv2rgb_factory_init (int mode, int swapped, uint8_t *colormap); | ||
140 | |||
141 | |||
142 | /* | ||
143 | * internal stuff below this line | ||
144 | */ | ||
145 | |||
146 | void mmx_yuv2rgb_set_gamma(int gamma); | ||
147 | void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this); | ||
148 | void yuv2rgb_init_mmx (yuv2rgb_factory_t *this); | ||
149 | void yuv2rgb_init_mlib (yuv2rgb_factory_t *this); | ||
150 | |||
151 | #endif | ||