Diffstat (limited to 'noncore/multimedia/opieplayer2/yuv2rgb.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/yuv2rgb.h | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb.h b/noncore/multimedia/opieplayer2/yuv2rgb.h index e453243..1833889 100644 --- a/noncore/multimedia/opieplayer2/yuv2rgb.h +++ b/noncore/multimedia/opieplayer2/yuv2rgb.h | |||
@@ -1,10 +1,14 @@ | |||
1 | 1 | ||
2 | #ifndef HAVE_YUV2RGB_H | 2 | #ifndef HAVE_YUV2RGB_H |
3 | #define HAVE_YUV2RGB_h | 3 | #define HAVE_YUV2RGB_h |
4 | 4 | ||
5 | #ifdef HAVE_MLIB | ||
6 | #include <mlib_video.h> | ||
7 | #endif | ||
8 | |||
5 | #include <inttypes.h> | 9 | #include <inttypes.h> |
6 | 10 | ||
7 | typedef struct yuv2rgb_s yuv2rgb_t; | 11 | typedef struct yuv2rgb_s yuv2rgb_t; |
8 | 12 | ||
9 | typedef struct yuv2rgb_factory_s yuv2rgb_factory_t; | 13 | typedef struct yuv2rgb_factory_s yuv2rgb_factory_t; |
10 | 14 | ||
@@ -19,13 +23,12 @@ typedef void (*scale_line_func_t) (uint8_t *source, uint8_t *dest, int width, in | |||
19 | typedef void (*yuv2rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * py, uint8_t * pu, uint8_t * pv) ; | 23 | typedef void (*yuv2rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * py, uint8_t * pu, uint8_t * pv) ; |
20 | 24 | ||
21 | typedef void (*yuy22rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * p); | 25 | typedef void (*yuy22rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * p); |
22 | 26 | ||
23 | typedef uint32_t (*yuv2rgb_single_pixel_fun_t) (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v); | 27 | typedef uint32_t (*yuv2rgb_single_pixel_fun_t) (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v); |
24 | 28 | ||
25 | |||
26 | /* | 29 | /* |
27 | * modes supported - feel free to implement yours | 30 | * modes supported - feel free to implement yours |
28 | */ | 31 | */ |
29 | 32 | ||
30 | #define MODE_8_RGB 1 | 33 | #define MODE_8_RGB 1 |
31 | #define MODE_8_BGR 2 | 34 | #define MODE_8_BGR 2 |
@@ -38,23 +41,32 @@ typedef uint32_t (*yuv2rgb_single_pixel_fun_t) (yuv2rgb_t *this, uint8_t y, uint | |||
38 | #define MODE_32_RGB 9 | 41 | #define MODE_32_RGB 9 |
39 | #define MODE_32_BGR 10 | 42 | #define MODE_32_BGR 10 |
40 | #defineMODE_8_GRAY 11 | 43 | #defineMODE_8_GRAY 11 |
41 | #define MODE_PALETTE 12 | 44 | #define MODE_PALETTE 12 |
42 | 45 | ||
43 | struct yuv2rgb_s { | 46 | struct yuv2rgb_s { |
44 | |||
45 | /* | 47 | /* |
46 | * configure converter for scaling factors | 48 | * configure converter for scaling factors |
47 | */ | 49 | */ |
48 | int (*configure) (yuv2rgb_t *this, | 50 | int (*configure) (yuv2rgb_t *this, |
49 | int source_width, int source_height, | 51 | int source_width, int source_height, |
50 | int y_stride, int uv_stride, | 52 | int y_stride, int uv_stride, |
51 | int dest_width, int dest_height, | 53 | int dest_width, int dest_height, |
52 | int rgb_stride); | 54 | int rgb_stride); |
53 | 55 | ||
54 | /* | 56 | /* |
57 | * start a new field or frame if dest is NULL | ||
58 | */ | ||
59 | int (*next_slice) (yuv2rgb_t *this, uint8_t **dest); | ||
60 | |||
61 | /* | ||
62 | * free resources | ||
63 | */ | ||
64 | void (*dispose) (yuv2rgb_t *this); | ||
65 | |||
66 | /* | ||
55 | * this is the function to call for the yuv2rgb and scaling process | 67 | * this is the function to call for the yuv2rgb and scaling process |
56 | */ | 68 | */ |
57 | yuv2rgb_fun_t yuv2rgb_fun; | 69 | yuv2rgb_fun_t yuv2rgb_fun; |
58 | 70 | ||
59 | /* | 71 | /* |
60 | * this is the function to call for the yuy2->rgb and scaling process | 72 | * this is the function to call for the yuy2->rgb and scaling process |
@@ -71,82 +83,90 @@ struct yuv2rgb_s { | |||
71 | /* private stuff below */ | 83 | /* private stuff below */ |
72 | 84 | ||
73 | int source_width, source_height; | 85 | int source_width, source_height; |
74 | int y_stride, uv_stride; | 86 | int y_stride, uv_stride; |
75 | int dest_width, dest_height; | 87 | int dest_width, dest_height; |
76 | int rgb_stride; | 88 | int rgb_stride; |
89 | int slice_height, slice_offset; | ||
77 | int step_dx, step_dy; | 90 | int step_dx, step_dy; |
78 | int do_scale; | 91 | int do_scale, swapped; |
79 | 92 | ||
80 | uint8_t *y_buffer; | 93 | uint8_t *y_buffer; |
81 | uint8_t *u_buffer; | 94 | uint8_t *u_buffer; |
82 | uint8_t *v_buffer; | 95 | uint8_t *v_buffer; |
83 | void *y_chunk; | 96 | void *y_chunk; |
84 | void *u_chunk; | 97 | void *u_chunk; |
85 | void *v_chunk; | 98 | void *v_chunk; |
86 | 99 | ||
100 | #ifdef HAVE_MLIB | ||
101 | uint8_t *mlib_buffer; | ||
102 | uint8_t *mlib_resize_buffer; | ||
103 | void *mlib_chunk; | ||
104 | void *mlib_resize_chunk; | ||
105 | mlib_filter mlib_filter_type; | ||
106 | #endif | ||
107 | |||
87 | void **table_rV; | 108 | void **table_rV; |
88 | void **table_gU; | 109 | void **table_gU; |
89 | int *table_gV; | 110 | int *table_gV; |
90 | void **table_bU; | 111 | void **table_bU; |
112 | void *table_mmx; | ||
91 | 113 | ||
92 | uint8_t *cmap; | 114 | uint8_t *cmap; |
93 | scale_line_func_t scale_line; | 115 | scale_line_func_t scale_line; |
94 | |||
95 | } ; | 116 | } ; |
96 | 117 | ||
97 | /* | 118 | /* |
98 | * convenience class to easily create a lot of converters | 119 | * convenience class to easily create a lot of converters |
99 | */ | 120 | */ |
100 | 121 | ||
101 | struct yuv2rgb_factory_s { | 122 | struct yuv2rgb_factory_s { |
102 | |||
103 | yuv2rgb_t* (*create_converter) (yuv2rgb_factory_t *this); | 123 | yuv2rgb_t* (*create_converter) (yuv2rgb_factory_t *this); |
104 | 124 | ||
105 | /* | 125 | /* |
106 | * adjust gamma (-100 to 100 looks fine) | 126 | * set color space conversion levels |
107 | * for all converters produced by this factory | 127 | * for all converters produced by this factory |
108 | */ | 128 | */ |
109 | void (*set_gamma) (yuv2rgb_factory_t *this, int gamma); | 129 | void (*set_csc_levels) (yuv2rgb_factory_t *this, |
130 | int brightness, int contrast, int saturation); | ||
110 | 131 | ||
111 | /* | 132 | /* |
112 | * get gamma value | 133 | * free resources |
113 | */ | 134 | */ |
114 | int (*get_gamma) (yuv2rgb_factory_t *this); | 135 | void (*dispose) (yuv2rgb_factory_t *this); |
115 | 136 | ||
116 | /* private data */ | 137 | /* private data */ |
117 | 138 | ||
118 | int mode; | 139 | int mode; |
119 | int swapped; | 140 | int swapped; |
120 | uint8_t *cmap; | 141 | uint8_t *cmap; |
121 | 142 | ||
122 | int gamma; | ||
123 | int entry_size; | ||
124 | |||
125 | uint32_t matrix_coefficients; | 143 | uint32_t matrix_coefficients; |
126 | 144 | ||
145 | void *table_base; | ||
127 | void *table_rV[256]; | 146 | void *table_rV[256]; |
128 | void *table_gU[256]; | 147 | void *table_gU[256]; |
129 | int table_gV[256]; | 148 | int table_gV[256]; |
130 | void *table_bU[256]; | 149 | void *table_bU[256]; |
150 | void *table_mmx_base; | ||
151 | void *table_mmx; | ||
131 | 152 | ||
132 | /* preselected functions for mode/swap/hardware */ | 153 | /* preselected functions for mode/swap/hardware */ |
133 | yuv2rgb_fun_t yuv2rgb_fun; | 154 | yuv2rgb_fun_t yuv2rgb_fun; |
134 | yuy22rgb_fun_t yuy22rgb_fun; | 155 | yuy22rgb_fun_t yuy22rgb_fun; |
135 | yuv2rgb_single_pixel_fun_t yuv2rgb_single_pixel_fun; | 156 | yuv2rgb_single_pixel_fun_t yuv2rgb_single_pixel_fun; |
136 | |||
137 | }; | 157 | }; |
138 | 158 | ||
139 | yuv2rgb_factory_t *yuv2rgb_factory_init (int mode, int swapped, uint8_t *colormap); | 159 | yuv2rgb_factory_t *yuv2rgb_factory_init (int mode, int swapped, uint8_t *colormap); |
140 | 160 | ||
141 | 161 | ||
142 | /* | 162 | /* |
143 | * internal stuff below this line | 163 | * internal stuff below this line |
144 | */ | 164 | */ |
145 | 165 | ||
146 | void mmx_yuv2rgb_set_gamma(int gamma); | 166 | void mmx_yuv2rgb_set_csc_levels(yuv2rgb_factory_t *this, |
167 | int brightness, int contrast, int saturation); | ||
147 | void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this); | 168 | void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this); |
148 | void yuv2rgb_init_mmx (yuv2rgb_factory_t *this); | 169 | void yuv2rgb_init_mmx (yuv2rgb_factory_t *this); |
149 | void yuv2rgb_init_mlib (yuv2rgb_factory_t *this); | 170 | void yuv2rgb_init_mlib (yuv2rgb_factory_t *this); |
150 | void yuv2rgb_init_arm (yuv2rgb_factory_t *this); | ||
151 | 171 | ||
152 | #endif | 172 | #endif |