-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/yuv2rgb.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index a49f9d3..095f206 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c | |||
@@ -1,373 +1,375 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 LJP <> | 5 | Copyright (c) 2002 LJP <> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <stdlib.h> | 34 | #include <stdlib.h> |
35 | #include <stdio.h> | 35 | #include <stdio.h> |
36 | 36 | ||
37 | #include <math.h> | 37 | #include <math.h> |
38 | 38 | ||
39 | #include <xine.h> | 39 | #include <xine.h> |
40 | #include <xine/video_out.h> | 40 | #include <xine/video_out.h> |
41 | #include <xine/xine_internal.h> | 41 | #include <xine/xine_internal.h> |
42 | #include <xine/xineutils.h> | 42 | #include <xine/xineutils.h> |
43 | #include <xine/vo_scale.h> | 43 | #include <xine/vo_scale.h> |
44 | #include <xine/buffer.h> | 44 | #include <xine/buffer.h> |
45 | 45 | ||
46 | #include <pthread.h> | 46 | #include <pthread.h> |
47 | #include "alphablend.h" | 47 | #include "alphablend.h" |
48 | #include "yuv2rgb.h" | 48 | #include "yuv2rgb.h" |
49 | 49 | ||
50 | #define printf(x,...) | 50 | #define printf(x,...) |
51 | 51 | ||
52 | /* | 52 | /* |
53 | #define LOG | 53 | #define LOG |
54 | */ | 54 | */ |
55 | 55 | ||
56 | /* the caller for our event draw handler */ | 56 | /* the caller for our event draw handler */ |
57 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 57 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
58 | int width, int height,int bytes ); | 58 | int width, int height,int bytes ); |
59 | 59 | ||
60 | typedef struct null_driver_s null_driver_t; | 60 | typedef struct null_driver_s null_driver_t; |
61 | 61 | ||
62 | struct null_driver_s { | 62 | struct null_driver_s { |
63 | vo_driver_t vo_driver; | 63 | vo_driver_t vo_driver; |
64 | 64 | ||
65 | uint32_t m_capabilities; | 65 | uint32_t m_capabilities; |
66 | int m_show_video; | 66 | int m_show_video; |
67 | int m_video_fullscreen; | 67 | int m_video_fullscreen; |
68 | int m_is_scaling; | 68 | int m_is_scaling; |
69 | 69 | ||
70 | int depth, bpp, bytes_per_pixel; | 70 | int depth, bpp, bytes_per_pixel; |
71 | int yuv2rgb_mode; | 71 | int yuv2rgb_mode; |
72 | int yuv2rgb_swap; | 72 | int yuv2rgb_swap; |
73 | int yuv2rgb_gamma; | 73 | int yuv2rgb_gamma; |
74 | uint8_t *yuv2rgb_cmap; | 74 | uint8_t *yuv2rgb_cmap; |
75 | yuv2rgb_factory_t *yuv2rgb_factory; | 75 | yuv2rgb_factory_t *yuv2rgb_factory; |
76 | 76 | ||
77 | vo_overlay_t *overlay; | 77 | vo_overlay_t *overlay; |
78 | vo_scale_t sc; | 78 | vo_scale_t sc; |
79 | 79 | ||
80 | int gui_width; | 80 | int gui_width; |
81 | int gui_height; | 81 | int gui_height; |
82 | int gui_changed; | 82 | int gui_changed; |
83 | 83 | ||
84 | double display_ratio; | 84 | double display_ratio; |
85 | void* caller; | 85 | void* caller; |
86 | display_xine_frame_t frameDis; | 86 | display_xine_frame_t frameDis; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | typedef struct opie_frame_s opie_frame_t; | 89 | typedef struct opie_frame_s opie_frame_t; |
90 | struct opie_frame_s { | 90 | struct opie_frame_s { |
91 | vo_frame_t frame; | 91 | vo_frame_t frame; |
92 | 92 | ||
93 | int format; | 93 | int format; |
94 | int flags; | 94 | int flags; |
95 | 95 | ||
96 | vo_scale_t sc; | 96 | vo_scale_t sc; |
97 | 97 | ||
98 | uint8_t *chunk[3]; | 98 | uint8_t *chunk[3]; |
99 | 99 | ||
100 | uint8_t *data; /* rgb */ | 100 | uint8_t *data; /* rgb */ |
101 | int bytes_per_line; | 101 | int bytes_per_line; |
102 | 102 | ||
103 | yuv2rgb_t *yuv2rgb; | 103 | yuv2rgb_t *yuv2rgb; |
104 | uint8_t *rgb_dst; | 104 | uint8_t *rgb_dst; |
105 | int yuv_stride; | 105 | int yuv_stride; |
106 | int stripe_height, stripe_inc; | 106 | int stripe_height, stripe_inc; |
107 | 107 | ||
108 | null_driver_t *output; | 108 | null_driver_t *output; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static uint32_t null_get_capabilities( vo_driver_t *self ){ | 111 | static uint32_t null_get_capabilities( vo_driver_t *self ){ |
112 | null_driver_t* this = (null_driver_t*)self; | 112 | null_driver_t* this = (null_driver_t*)self; |
113 | return this->m_capabilities; | 113 | return this->m_capabilities; |
114 | } | 114 | } |
115 | 115 | ||
116 | static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { | 116 | static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { |
117 | opie_frame_t *frame = (opie_frame_t *) vo_img ; | 117 | opie_frame_t *frame = (opie_frame_t *) vo_img ; |
118 | |||
119 | vo_img->copy_called = 1; | ||
118 | 120 | ||
119 | if (!frame->output->m_show_video) { | 121 | if (!frame->output->m_show_video) { |
120 | /* printf("nullvideo: no video\n"); */ | 122 | /* printf("nullvideo: no video\n"); */ |
121 | return; | 123 | return; |
122 | } | 124 | } |
123 | 125 | ||
124 | if (frame->format == XINE_IMGFMT_YV12) { | 126 | if (frame->format == XINE_IMGFMT_YV12) { |
125 | frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, | 127 | frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, |
126 | src[0], src[1], src[2]); | 128 | src[0], src[1], src[2]); |
127 | } else { | 129 | } else { |
128 | 130 | ||
129 | frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, | 131 | frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, |
130 | src[0]); | 132 | src[0]); |
131 | } | 133 | } |
132 | 134 | ||
133 | frame->rgb_dst += frame->stripe_inc; | 135 | frame->rgb_dst += frame->stripe_inc; |
134 | } | 136 | } |
135 | 137 | ||
136 | static void null_frame_field (vo_frame_t *vo_img, int which_field) { | 138 | static void null_frame_field (vo_frame_t *vo_img, int which_field) { |
137 | 139 | ||
138 | opie_frame_t *frame = (opie_frame_t *) vo_img ; | 140 | opie_frame_t *frame = (opie_frame_t *) vo_img ; |
139 | 141 | ||
140 | switch (which_field) { | 142 | switch (which_field) { |
141 | case VO_TOP_FIELD: | 143 | case VO_TOP_FIELD: |
142 | frame->rgb_dst = (uint8_t *)frame->data; | 144 | frame->rgb_dst = (uint8_t *)frame->data; |
143 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; | 145 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; |
144 | break; | 146 | break; |
145 | case VO_BOTTOM_FIELD: | 147 | case VO_BOTTOM_FIELD: |
146 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; | 148 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; |
147 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; | 149 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; |
148 | break; | 150 | break; |
149 | case VO_BOTH_FIELDS: | 151 | case VO_BOTH_FIELDS: |
150 | frame->rgb_dst = (uint8_t *)frame->data; | 152 | frame->rgb_dst = (uint8_t *)frame->data; |
151 | break; | 153 | break; |
152 | } | 154 | } |
153 | } | 155 | } |
154 | 156 | ||
155 | 157 | ||
156 | /* take care of the frame*/ | 158 | /* take care of the frame*/ |
157 | static void null_frame_dispose( vo_frame_t* vo_img){ | 159 | static void null_frame_dispose( vo_frame_t* vo_img){ |
158 | opie_frame_t* frame = (opie_frame_t*)vo_img; | 160 | opie_frame_t* frame = (opie_frame_t*)vo_img; |
159 | 161 | ||
160 | if (frame->data) | 162 | if (frame->data) |
161 | free( frame->data ); | 163 | free( frame->data ); |
162 | free (frame); | 164 | free (frame); |
163 | } | 165 | } |
164 | 166 | ||
165 | /* end take care of frames*/ | 167 | /* end take care of frames*/ |
166 | 168 | ||
167 | static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ | 169 | static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ |
168 | 170 | ||
169 | null_driver_t* this = (null_driver_t*)self; | 171 | null_driver_t* this = (null_driver_t*)self; |
170 | opie_frame_t* frame; | 172 | opie_frame_t* frame; |
171 | 173 | ||
172 | #ifdef LOG | 174 | #ifdef LOG |
173 | fprintf (stderr, "nullvideo: alloc_frame\n"); | 175 | fprintf (stderr, "nullvideo: alloc_frame\n"); |
174 | #endif | 176 | #endif |
175 | 177 | ||
176 | frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); | 178 | frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); |
177 | 179 | ||
178 | memset( frame, 0, sizeof( opie_frame_t) ); | 180 | memset( frame, 0, sizeof( opie_frame_t) ); |
179 | memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t)); | 181 | memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t)); |
180 | 182 | ||
181 | pthread_mutex_init (&frame->frame.mutex, NULL); | 183 | pthread_mutex_init (&frame->frame.mutex, NULL); |
182 | 184 | ||
183 | frame->output = this; | 185 | frame->output = this; |
184 | 186 | ||
185 | /* initialize the frame*/ | 187 | /* initialize the frame*/ |
186 | frame->frame.driver = self; | 188 | frame->frame.driver = self; |
187 | frame->frame.copy = null_frame_copy; | 189 | frame->frame.copy = null_frame_copy; |
188 | frame->frame.field = null_frame_field; | 190 | frame->frame.field = null_frame_field; |
189 | frame->frame.dispose = null_frame_dispose; | 191 | frame->frame.dispose = null_frame_dispose; |
190 | 192 | ||
191 | /* | 193 | /* |
192 | * colorspace converter for this frame | 194 | * colorspace converter for this frame |
193 | */ | 195 | */ |
194 | frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); | 196 | frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); |
195 | 197 | ||
196 | return (vo_frame_t*) frame; | 198 | return (vo_frame_t*) frame; |
197 | } | 199 | } |
198 | 200 | ||
199 | static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, | 201 | static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, |
200 | uint32_t width, uint32_t height, | 202 | uint32_t width, uint32_t height, |
201 | int ratio_code, int format, int flags ){ | 203 | int ratio_code, int format, int flags ){ |
202 | null_driver_t* this = (null_driver_t*) self; | 204 | null_driver_t* this = (null_driver_t*) self; |
203 | opie_frame_t* frame = (opie_frame_t*)img; | 205 | opie_frame_t* frame = (opie_frame_t*)img; |
204 | /* not needed now */ | 206 | /* not needed now */ |
205 | 207 | ||
206 | #ifdef LOG | 208 | #ifdef LOG |
207 | fprintf (stderr, "nullvideo: update_frame_format\n"); | 209 | fprintf (stderr, "nullvideo: update_frame_format\n"); |
208 | #endif | 210 | #endif |
209 | 211 | ||
210 | flags &= VO_BOTH_FIELDS; | 212 | flags &= VO_BOTH_FIELDS; |
211 | 213 | ||
212 | /* find out if we need to adapt this frame */ | 214 | /* find out if we need to adapt this frame */ |
213 | 215 | ||
214 | if ((width != frame->sc.delivered_width) | 216 | if ((width != frame->sc.delivered_width) |
215 | || (height != frame->sc.delivered_height) | 217 | || (height != frame->sc.delivered_height) |
216 | || (ratio_code != frame->sc.delivered_ratio_code) | 218 | || (ratio_code != frame->sc.delivered_ratio_code) |
217 | || (flags != frame->flags) | 219 | || (flags != frame->flags) |
218 | || (format != frame->format) | 220 | || (format != frame->format) |
219 | || (this->sc.user_ratio != frame->sc.user_ratio) | 221 | || (this->sc.user_ratio != frame->sc.user_ratio) |
220 | || (this->gui_width != frame->sc.gui_width) | 222 | || (this->gui_width != frame->sc.gui_width) |
221 | || (this->gui_height != frame->sc.gui_height)) { | 223 | || (this->gui_height != frame->sc.gui_height)) { |
222 | 224 | ||
223 | frame->sc.delivered_width = width; | 225 | frame->sc.delivered_width = width; |
224 | frame->sc.delivered_height = height; | 226 | frame->sc.delivered_height = height; |
225 | frame->sc.delivered_ratio_code = ratio_code; | 227 | frame->sc.delivered_ratio_code = ratio_code; |
226 | frame->flags = flags; | 228 | frame->flags = flags; |
227 | frame->format = format; | 229 | frame->format = format; |
228 | frame->sc.user_ratio = this->sc.user_ratio; | 230 | frame->sc.user_ratio = this->sc.user_ratio; |
229 | frame->sc.gui_width = this->gui_width; | 231 | frame->sc.gui_width = this->gui_width; |
230 | frame->sc.gui_height = this->gui_height; | 232 | frame->sc.gui_height = this->gui_height; |
231 | frame->sc.gui_pixel_aspect = 1.0; | 233 | frame->sc.gui_pixel_aspect = 1.0; |
232 | 234 | ||
233 | vo_scale_compute_ideal_size ( &frame->sc ); | 235 | vo_scale_compute_ideal_size ( &frame->sc ); |
234 | vo_scale_compute_output_size( &frame->sc ); | 236 | vo_scale_compute_output_size( &frame->sc ); |
235 | 237 | ||
236 | #ifdef LOG | 238 | #ifdef LOG |
237 | fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n", | 239 | fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n", |
238 | frame->sc.gui_width, frame->sc.gui_height, | 240 | frame->sc.gui_width, frame->sc.gui_height, |
239 | frame->sc.delivered_width, frame->sc.delivered_height, | 241 | frame->sc.delivered_width, frame->sc.delivered_height, |
240 | frame->sc.output_width, frame->sc.output_height); | 242 | frame->sc.output_width, frame->sc.output_height); |
241 | #endif | 243 | #endif |
242 | 244 | ||
243 | /* | 245 | /* |
244 | * (re-) allocate | 246 | * (re-) allocate |
245 | */ | 247 | */ |
246 | if( frame->data ) { | 248 | if( frame->data ) { |
247 | if( frame->chunk[0] ){ | 249 | if( frame->chunk[0] ){ |
248 | free( frame->chunk[0] ); | 250 | free( frame->chunk[0] ); |
249 | frame->chunk[0] = NULL; | 251 | frame->chunk[0] = NULL; |
250 | } | 252 | } |
251 | if( frame->chunk[1] ){ | 253 | if( frame->chunk[1] ){ |
252 | free ( frame->chunk[1] ); | 254 | free ( frame->chunk[1] ); |
253 | frame->chunk[1] = NULL; | 255 | frame->chunk[1] = NULL; |
254 | } | 256 | } |
255 | if( frame->chunk[2] ){ | 257 | if( frame->chunk[2] ){ |
256 | free ( frame->chunk[2] ); | 258 | free ( frame->chunk[2] ); |
257 | frame->chunk[2] = NULL; | 259 | frame->chunk[2] = NULL; |
258 | } | 260 | } |
259 | free ( frame->data ); | 261 | free ( frame->data ); |
260 | } | 262 | } |
261 | 263 | ||
262 | frame->data = xine_xmalloc (frame->sc.output_width | 264 | frame->data = xine_xmalloc (frame->sc.output_width |
263 | * frame->sc.output_height | 265 | * frame->sc.output_height |
264 | * this->bytes_per_pixel ); | 266 | * this->bytes_per_pixel ); |
265 | 267 | ||
266 | if( format == XINE_IMGFMT_YV12 ) { | 268 | if( format == XINE_IMGFMT_YV12 ) { |
267 | frame->frame.pitches[0] = 8*((width + 7) / 8); | 269 | frame->frame.pitches[0] = 8*((width + 7) / 8); |
268 | frame->frame.pitches[1] = 8*((width + 15) / 16); | 270 | frame->frame.pitches[1] = 8*((width + 15) / 16); |
269 | frame->frame.pitches[2] = 8*((width + 15) / 16); | 271 | frame->frame.pitches[2] = 8*((width + 15) / 16); |
270 | frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]); | 272 | frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]); |
271 | frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]); | 273 | frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]); |
272 | frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]); | 274 | frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]); |
273 | 275 | ||
274 | }else{ | 276 | }else{ |
275 | frame->frame.pitches[0] = 8*((width + 3) / 4); | 277 | frame->frame.pitches[0] = 8*((width + 3) / 4); |
276 | 278 | ||
277 | frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height, | 279 | frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height, |
278 | (void **)&frame->chunk[0]); | 280 | (void **)&frame->chunk[0]); |
279 | frame->chunk[1] = NULL; | 281 | frame->chunk[1] = NULL; |
280 | frame->chunk[2] = NULL; | 282 | frame->chunk[2] = NULL; |
281 | } | 283 | } |
282 | 284 | ||
283 | frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height; | 285 | frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height; |
284 | frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; | 286 | frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; |
285 | 287 | ||
286 | /* | 288 | /* |
287 | * set up colorspace converter | 289 | * set up colorspace converter |
288 | */ | 290 | */ |
289 | 291 | ||
290 | switch (flags) { | 292 | switch (flags) { |
291 | case VO_TOP_FIELD: | 293 | case VO_TOP_FIELD: |
292 | case VO_BOTTOM_FIELD: | 294 | case VO_BOTTOM_FIELD: |
293 | frame->yuv2rgb->configure (frame->yuv2rgb, | 295 | frame->yuv2rgb->configure (frame->yuv2rgb, |
294 | frame->sc.delivered_width, | 296 | frame->sc.delivered_width, |
295 | 16, | 297 | 16, |
296 | 2*frame->frame.pitches[0], | 298 | 2*frame->frame.pitches[0], |
297 | 2*frame->frame.pitches[1], | 299 | 2*frame->frame.pitches[1], |
298 | frame->sc.output_width, | 300 | frame->sc.output_width, |
299 | frame->stripe_height, | 301 | frame->stripe_height, |
300 | frame->bytes_per_line*2); | 302 | frame->bytes_per_line*2); |
301 | frame->yuv_stride = frame->bytes_per_line*2; | 303 | frame->yuv_stride = frame->bytes_per_line*2; |
302 | break; | 304 | break; |
303 | case VO_BOTH_FIELDS: | 305 | case VO_BOTH_FIELDS: |
304 | frame->yuv2rgb->configure (frame->yuv2rgb, | 306 | frame->yuv2rgb->configure (frame->yuv2rgb, |
305 | frame->sc.delivered_width, | 307 | frame->sc.delivered_width, |
306 | 16, | 308 | 16, |
307 | frame->frame.pitches[0], | 309 | frame->frame.pitches[0], |
308 | frame->frame.pitches[1], | 310 | frame->frame.pitches[1], |
309 | frame->sc.output_width, | 311 | frame->sc.output_width, |
310 | frame->stripe_height, | 312 | frame->stripe_height, |
311 | frame->bytes_per_line); | 313 | frame->bytes_per_line); |
312 | frame->yuv_stride = frame->bytes_per_line; | 314 | frame->yuv_stride = frame->bytes_per_line; |
313 | break; | 315 | break; |
314 | } | 316 | } |
315 | #ifdef LOG | 317 | #ifdef LOG |
316 | fprintf (stderr, "nullvideo: colorspace converter configured.\n"); | 318 | fprintf (stderr, "nullvideo: colorspace converter configured.\n"); |
317 | #endif | 319 | #endif |
318 | } | 320 | } |
319 | 321 | ||
320 | /* | 322 | /* |
321 | * reset dest pointers | 323 | * reset dest pointers |
322 | */ | 324 | */ |
323 | 325 | ||
324 | if (frame->data) { | 326 | if (frame->data) { |
325 | switch (flags) { | 327 | switch (flags) { |
326 | case VO_TOP_FIELD: | 328 | case VO_TOP_FIELD: |
327 | frame->rgb_dst = (uint8_t *)frame->data; | 329 | frame->rgb_dst = (uint8_t *)frame->data; |
328 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; | 330 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; |
329 | break; | 331 | break; |
330 | case VO_BOTTOM_FIELD: | 332 | case VO_BOTTOM_FIELD: |
331 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; | 333 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; |
332 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; | 334 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; |
333 | break; | 335 | break; |
334 | case VO_BOTH_FIELDS: | 336 | case VO_BOTH_FIELDS: |
335 | frame->rgb_dst = (uint8_t *)frame->data; | 337 | frame->rgb_dst = (uint8_t *)frame->data; |
336 | frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; | 338 | frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; |
337 | break; | 339 | break; |
338 | } | 340 | } |
339 | } | 341 | } |
340 | } | 342 | } |
341 | 343 | ||
342 | static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ | 344 | static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ |
343 | null_driver_t* this = (null_driver_t*) self; | 345 | null_driver_t* this = (null_driver_t*) self; |
344 | opie_frame_t* frame = (opie_frame_t*)frame_gen; | 346 | opie_frame_t* frame = (opie_frame_t*)frame_gen; |
345 | display_xine_frame_t display = this->frameDis; | 347 | display_xine_frame_t display = this->frameDis; |
346 | 348 | ||
347 | if (!this->m_show_video) | 349 | if (!this->m_show_video) |
348 | return; | 350 | return; |
349 | 351 | ||
350 | if( display != NULL ) { | 352 | if( display != NULL ) { |
351 | (*display)(this->caller, frame->data, | 353 | (*display)(this->caller, frame->data, |
352 | frame->sc.output_width, frame->sc.output_height, | 354 | frame->sc.output_width, frame->sc.output_height, |
353 | frame->bytes_per_line ); | 355 | frame->bytes_per_line ); |
354 | } | 356 | } |
355 | 357 | ||
356 | frame->frame.displayed (&frame->frame); | 358 | frame->frame.displayed (&frame->frame); |
357 | } | 359 | } |
358 | 360 | ||
359 | 361 | ||
360 | /* blending related */ | 362 | /* blending related */ |
361 | static void null_overlay_clut_yuv2rgb (null_driver_t *this, | 363 | static void null_overlay_clut_yuv2rgb (null_driver_t *this, |
362 | vo_overlay_t *overlay, | 364 | vo_overlay_t *overlay, |
363 | opie_frame_t *frame) { | 365 | opie_frame_t *frame) { |
364 | int i; | 366 | int i; |
365 | clut_t* clut = (clut_t*) overlay->color; | 367 | clut_t* clut = (clut_t*) overlay->color; |
366 | if (!overlay->rgb_clut) { | 368 | if (!overlay->rgb_clut) { |
367 | for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { | 369 | for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { |
368 | *((uint32_t *)&clut[i]) = | 370 | *((uint32_t *)&clut[i]) = |
369 | frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, | 371 | frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, |
370 | clut[i].y, clut[i].cb, clut[i].cr); | 372 | clut[i].y, clut[i].cb, clut[i].cr); |
371 | } | 373 | } |
372 | overlay->rgb_clut++; | 374 | overlay->rgb_clut++; |
373 | } | 375 | } |
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb.c b/noncore/multimedia/opieplayer2/yuv2rgb.c index e8e86e6..8e34052 100644 --- a/noncore/multimedia/opieplayer2/yuv2rgb.c +++ b/noncore/multimedia/opieplayer2/yuv2rgb.c | |||
@@ -954,517 +954,517 @@ done: | |||
954 | /* | 954 | /* |
955 | * Interpolates 24 output pixels from 11 source pixels using shifts. | 955 | * Interpolates 24 output pixels from 11 source pixels using shifts. |
956 | * Useful for scaling a PAL vcd input source to 4:3 display format | 956 | * Useful for scaling a PAL vcd input source to 4:3 display format |
957 | * at 2*zoom. | 957 | * at 2*zoom. |
958 | */ | 958 | */ |
959 | static void scale_line_11_24 (uint8_t *source, uint8_t *dest, | 959 | static void scale_line_11_24 (uint8_t *source, uint8_t *dest, |
960 | int width, int step) { | 960 | int width, int step) { |
961 | 961 | ||
962 | int p1, p2; | 962 | int p1, p2; |
963 | 963 | ||
964 | xine_profiler_start_count(prof_scale_line); | 964 | xine_profiler_start_count(prof_scale_line); |
965 | 965 | ||
966 | while ((width -= 24) >= 0) { | 966 | while ((width -= 24) >= 0) { |
967 | p1 = source[0]; | 967 | p1 = source[0]; |
968 | p2 = source[1]; | 968 | p2 = source[1]; |
969 | dest[0] = p1; | 969 | dest[0] = p1; |
970 | dest[1] = (1*p1 + 1*p2) >> 1; | 970 | dest[1] = (1*p1 + 1*p2) >> 1; |
971 | dest[2] = (1*p1 + 7*p2) >> 3; | 971 | dest[2] = (1*p1 + 7*p2) >> 3; |
972 | p1 = source[2]; | 972 | p1 = source[2]; |
973 | dest[3] = (5*p2 + 3*p1) >> 3; | 973 | dest[3] = (5*p2 + 3*p1) >> 3; |
974 | dest[4] = (1*p2 + 7*p1) >> 3; | 974 | dest[4] = (1*p2 + 7*p1) >> 3; |
975 | p2 = source[3]; | 975 | p2 = source[3]; |
976 | dest[5] = (3*p1 + 1*p2) >> 2; | 976 | dest[5] = (3*p1 + 1*p2) >> 2; |
977 | dest[6] = (1*p1 + 3*p2) >> 2; | 977 | dest[6] = (1*p1 + 3*p2) >> 2; |
978 | p1 = source[4]; | 978 | p1 = source[4]; |
979 | dest[7] = (3*p2 + 1*p1) >> 2; | 979 | dest[7] = (3*p2 + 1*p1) >> 2; |
980 | dest[8] = (3*p2 + 5*p1) >> 3; | 980 | dest[8] = (3*p2 + 5*p1) >> 3; |
981 | p2 = source[5]; | 981 | p2 = source[5]; |
982 | dest[9] = (7*p1 + 1*p2) >> 3; | 982 | dest[9] = (7*p1 + 1*p2) >> 3; |
983 | dest[10] = (3*p1 + 5*p2) >> 3; | 983 | dest[10] = (3*p1 + 5*p2) >> 3; |
984 | p1 = source[6]; | 984 | p1 = source[6]; |
985 | dest[11] = p2; | 985 | dest[11] = p2; |
986 | dest[12] = (1*p2 + 1*p1) >> 1; | 986 | dest[12] = (1*p2 + 1*p1) >> 1; |
987 | dest[13] = p1; | 987 | dest[13] = p1; |
988 | p2 = source[7]; | 988 | p2 = source[7]; |
989 | dest[14] = (5*p1 + 3*p2) >> 3; | 989 | dest[14] = (5*p1 + 3*p2) >> 3; |
990 | dest[15] = (1*p1 + 7*p2) >> 3; | 990 | dest[15] = (1*p1 + 7*p2) >> 3; |
991 | p1 = source[8]; | 991 | p1 = source[8]; |
992 | dest[16] = (5*p2 + 3*p1) >> 3; | 992 | dest[16] = (5*p2 + 3*p1) >> 3; |
993 | dest[17] = (1*p2 + 3*p1) >> 2; | 993 | dest[17] = (1*p2 + 3*p1) >> 2; |
994 | p2 = source[9]; | 994 | p2 = source[9]; |
995 | dest[18] = (3*p1 + 1*p2) >> 2; | 995 | dest[18] = (3*p1 + 1*p2) >> 2; |
996 | dest[19] = (1*p1 + 3*p2) >> 2; | 996 | dest[19] = (1*p1 + 3*p2) >> 2; |
997 | p1 = source[10]; | 997 | p1 = source[10]; |
998 | dest[20] = (7*p2 + 1*p1) >> 3; | 998 | dest[20] = (7*p2 + 1*p1) >> 3; |
999 | dest[21] = (3*p2 + 5*p1) >> 3; | 999 | dest[21] = (3*p2 + 5*p1) >> 3; |
1000 | p2 = source[11]; | 1000 | p2 = source[11]; |
1001 | dest[22] = (7*p1 + 1*p2) >> 3; | 1001 | dest[22] = (7*p1 + 1*p2) >> 3; |
1002 | dest[23] = (1*p1 + 1*p2) >> 1; | 1002 | dest[23] = (1*p1 + 1*p2) >> 1; |
1003 | source += 11; | 1003 | source += 11; |
1004 | dest += 24; | 1004 | dest += 24; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | if ((width += 24) <= 0) goto done; | 1007 | if ((width += 24) <= 0) goto done; |
1008 | *dest++ = source[0]; | 1008 | *dest++ = source[0]; |
1009 | if (--width <= 0) goto done; | 1009 | if (--width <= 0) goto done; |
1010 | *dest++ = (1*source[0] + 1*source[1]) >> 1; | 1010 | *dest++ = (1*source[0] + 1*source[1]) >> 1; |
1011 | if (--width <= 0) goto done; | 1011 | if (--width <= 0) goto done; |
1012 | *dest++ = (1*source[0] + 7*source[1]) >> 3; | 1012 | *dest++ = (1*source[0] + 7*source[1]) >> 3; |
1013 | if (--width <= 0) goto done; | 1013 | if (--width <= 0) goto done; |
1014 | *dest++ = (5*source[1] + 3*source[2]) >> 3; | 1014 | *dest++ = (5*source[1] + 3*source[2]) >> 3; |
1015 | if (--width <= 0) goto done; | 1015 | if (--width <= 0) goto done; |
1016 | *dest++ = (1*source[1] + 7*source[2]) >> 3; | 1016 | *dest++ = (1*source[1] + 7*source[2]) >> 3; |
1017 | if (--width <= 0) goto done; | 1017 | if (--width <= 0) goto done; |
1018 | *dest++ = (3*source[2] + 1*source[3]) >> 2; | 1018 | *dest++ = (3*source[2] + 1*source[3]) >> 2; |
1019 | if (--width <= 0) goto done; | 1019 | if (--width <= 0) goto done; |
1020 | *dest++ = (1*source[2] + 3*source[3]) >> 2; | 1020 | *dest++ = (1*source[2] + 3*source[3]) >> 2; |
1021 | if (--width <= 0) goto done; | 1021 | if (--width <= 0) goto done; |
1022 | *dest++ = (3*source[3] + 1*source[4]) >> 2; | 1022 | *dest++ = (3*source[3] + 1*source[4]) >> 2; |
1023 | if (--width <= 0) goto done; | 1023 | if (--width <= 0) goto done; |
1024 | *dest++ = (3*source[3] + 5*source[4]) >> 3; | 1024 | *dest++ = (3*source[3] + 5*source[4]) >> 3; |
1025 | if (--width <= 0) goto done; | 1025 | if (--width <= 0) goto done; |
1026 | *dest++ = (7*source[4] + 1*source[5]) >> 3; | 1026 | *dest++ = (7*source[4] + 1*source[5]) >> 3; |
1027 | if (--width <= 0) goto done; | 1027 | if (--width <= 0) goto done; |
1028 | *dest++ = (3*source[4] + 5*source[5]) >> 3; | 1028 | *dest++ = (3*source[4] + 5*source[5]) >> 3; |
1029 | if (--width <= 0) goto done; | 1029 | if (--width <= 0) goto done; |
1030 | *dest++ = source[5]; | 1030 | *dest++ = source[5]; |
1031 | if (--width <= 0) goto done; | 1031 | if (--width <= 0) goto done; |
1032 | *dest++ = (1*source[5] + 1*source[6]) >> 1; | 1032 | *dest++ = (1*source[5] + 1*source[6]) >> 1; |
1033 | if (--width <= 0) goto done; | 1033 | if (--width <= 0) goto done; |
1034 | *dest++ = source[6]; | 1034 | *dest++ = source[6]; |
1035 | if (--width <= 0) goto done; | 1035 | if (--width <= 0) goto done; |
1036 | *dest++ = (5*source[6] + 3*source[7]) >> 3; | 1036 | *dest++ = (5*source[6] + 3*source[7]) >> 3; |
1037 | if (--width <= 0) goto done; | 1037 | if (--width <= 0) goto done; |
1038 | *dest++ = (1*source[6] + 7*source[7]) >> 3; | 1038 | *dest++ = (1*source[6] + 7*source[7]) >> 3; |
1039 | if (--width <= 0) goto done; | 1039 | if (--width <= 0) goto done; |
1040 | *dest++ = (5*source[7] + 3*source[8]) >> 3; | 1040 | *dest++ = (5*source[7] + 3*source[8]) >> 3; |
1041 | if (--width <= 0) goto done; | 1041 | if (--width <= 0) goto done; |
1042 | *dest++ = (1*source[7] + 3*source[8]) >> 2; | 1042 | *dest++ = (1*source[7] + 3*source[8]) >> 2; |
1043 | if (--width <= 0) goto done; | 1043 | if (--width <= 0) goto done; |
1044 | *dest++ = (3*source[8] + 1*source[9]) >> 2; | 1044 | *dest++ = (3*source[8] + 1*source[9]) >> 2; |
1045 | if (--width <= 0) goto done; | 1045 | if (--width <= 0) goto done; |
1046 | *dest++ = (1*source[8] + 3*source[9]) >> 2; | 1046 | *dest++ = (1*source[8] + 3*source[9]) >> 2; |
1047 | if (--width <= 0) goto done; | 1047 | if (--width <= 0) goto done; |
1048 | *dest++ = (7*source[9] + 1*source[10]) >> 3; | 1048 | *dest++ = (7*source[9] + 1*source[10]) >> 3; |
1049 | if (--width <= 0) goto done; | 1049 | if (--width <= 0) goto done; |
1050 | *dest++ = (3*source[9] + 5*source[10]) >> 3; | 1050 | *dest++ = (3*source[9] + 5*source[10]) >> 3; |
1051 | if (--width <= 0) goto done; | 1051 | if (--width <= 0) goto done; |
1052 | *dest++ = (7*source[10] + 1*source[11]) >> 3; | 1052 | *dest++ = (7*source[10] + 1*source[11]) >> 3; |
1053 | done: | 1053 | done: |
1054 | 1054 | ||
1055 | xine_profiler_stop_count(prof_scale_line); | 1055 | xine_profiler_stop_count(prof_scale_line); |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | 1058 | ||
1059 | /* | 1059 | /* |
1060 | * Interpolates 8 output pixels from 5 source pixels using shifts. | 1060 | * Interpolates 8 output pixels from 5 source pixels using shifts. |
1061 | * Useful for scaling a PAL svcd input source to 4:3 display format. | 1061 | * Useful for scaling a PAL svcd input source to 4:3 display format. |
1062 | */ | 1062 | */ |
1063 | static void scale_line_5_8 (uint8_t *source, uint8_t *dest, | 1063 | static void scale_line_5_8 (uint8_t *source, uint8_t *dest, |
1064 | int width, int step) { | 1064 | int width, int step) { |
1065 | 1065 | ||
1066 | int p1, p2; | 1066 | int p1, p2; |
1067 | 1067 | ||
1068 | xine_profiler_start_count(prof_scale_line); | 1068 | xine_profiler_start_count(prof_scale_line); |
1069 | 1069 | ||
1070 | while ((width -= 8) >= 0) { | 1070 | while ((width -= 8) >= 0) { |
1071 | p1 = source[0]; | 1071 | p1 = source[0]; |
1072 | p2 = source[1]; | 1072 | p2 = source[1]; |
1073 | dest[0] = p1; | 1073 | dest[0] = p1; |
1074 | dest[1] = (3*p1 + 5*p2) >> 3; | 1074 | dest[1] = (3*p1 + 5*p2) >> 3; |
1075 | p1 = source[2]; | 1075 | p1 = source[2]; |
1076 | dest[2] = (3*p2 + 1*p1) >> 2; | 1076 | dest[2] = (3*p2 + 1*p1) >> 2; |
1077 | dest[3] = (1*p2 + 7*p1) >> 3; | 1077 | dest[3] = (1*p2 + 7*p1) >> 3; |
1078 | p2 = source[3]; | 1078 | p2 = source[3]; |
1079 | dest[4] = (1*p1 + 1*p2) >> 1; | 1079 | dest[4] = (1*p1 + 1*p2) >> 1; |
1080 | p1 = source[4]; | 1080 | p1 = source[4]; |
1081 | dest[5] = (7*p2 + 1*p1) >> 3; | 1081 | dest[5] = (7*p2 + 1*p1) >> 3; |
1082 | dest[6] = (1*p2 + 3*p1) >> 2; | 1082 | dest[6] = (1*p2 + 3*p1) >> 2; |
1083 | p2 = source[5]; | 1083 | p2 = source[5]; |
1084 | dest[7] = (5*p1 + 3*p2) >> 3; | 1084 | dest[7] = (5*p1 + 3*p2) >> 3; |
1085 | source += 5; | 1085 | source += 5; |
1086 | dest += 8; | 1086 | dest += 8; |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | if ((width += 8) <= 0) goto done; | 1089 | if ((width += 8) <= 0) goto done; |
1090 | *dest++ = source[0]; | 1090 | *dest++ = source[0]; |
1091 | if (--width <= 0) goto done; | 1091 | if (--width <= 0) goto done; |
1092 | *dest++ = (3*source[0] + 5*source[1]) >> 3; | 1092 | *dest++ = (3*source[0] + 5*source[1]) >> 3; |
1093 | if (--width <= 0) goto done; | 1093 | if (--width <= 0) goto done; |
1094 | *dest++ = (3*source[1] + 1*source[2]) >> 2; | 1094 | *dest++ = (3*source[1] + 1*source[2]) >> 2; |
1095 | if (--width <= 0) goto done; | 1095 | if (--width <= 0) goto done; |
1096 | *dest++ = (1*source[1] + 7*source[2]) >> 3; | 1096 | *dest++ = (1*source[1] + 7*source[2]) >> 3; |
1097 | if (--width <= 0) goto done; | 1097 | if (--width <= 0) goto done; |
1098 | *dest++ = (1*source[2] + 1*source[3]) >> 1; | 1098 | *dest++ = (1*source[2] + 1*source[3]) >> 1; |
1099 | if (--width <= 0) goto done; | 1099 | if (--width <= 0) goto done; |
1100 | *dest++ = (7*source[3] + 1*source[4]) >> 3; | 1100 | *dest++ = (7*source[3] + 1*source[4]) >> 3; |
1101 | if (--width <= 0) goto done; | 1101 | if (--width <= 0) goto done; |
1102 | *dest++ = (1*source[3] + 3*source[4]) >> 2; | 1102 | *dest++ = (1*source[3] + 3*source[4]) >> 2; |
1103 | done: | 1103 | done: |
1104 | 1104 | ||
1105 | xine_profiler_stop_count(prof_scale_line); | 1105 | xine_profiler_stop_count(prof_scale_line); |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | 1108 | ||
1109 | /* | 1109 | /* |
1110 | * Interpolates 4 output pixels from 3 source pixels using shifts. | 1110 | * Interpolates 4 output pixels from 3 source pixels using shifts. |
1111 | * Useful for scaling a NTSC svcd input source to 4:3 display format. | 1111 | * Useful for scaling a NTSC svcd input source to 4:3 display format. |
1112 | */ | 1112 | */ |
1113 | static void scale_line_3_4 (uint8_t *source, uint8_t *dest, | 1113 | static void scale_line_3_4 (uint8_t *source, uint8_t *dest, |
1114 | int width, int step) { | 1114 | int width, int step) { |
1115 | 1115 | ||
1116 | int p1, p2; | 1116 | int p1, p2; |
1117 | 1117 | ||
1118 | xine_profiler_start_count(prof_scale_line); | 1118 | xine_profiler_start_count(prof_scale_line); |
1119 | 1119 | ||
1120 | while ((width -= 4) >= 0) { | 1120 | while ((width -= 4) >= 0) { |
1121 | p1 = source[0]; | 1121 | p1 = source[0]; |
1122 | p2 = source[1]; | 1122 | p2 = source[1]; |
1123 | dest[0] = p1; | 1123 | dest[0] = p1; |
1124 | dest[1] = (1*p1 + 3*p2) >> 2; | 1124 | dest[1] = (1*p1 + 3*p2) >> 2; |
1125 | p1 = source[2]; | 1125 | p1 = source[2]; |
1126 | dest[2] = (1*p2 + 1*p1) >> 1; | 1126 | dest[2] = (1*p2 + 1*p1) >> 1; |
1127 | p2 = source[3]; | 1127 | p2 = source[3]; |
1128 | dest[3] = (3*p1 + 1*p2) >> 2; | 1128 | dest[3] = (3*p1 + 1*p2) >> 2; |
1129 | source += 3; | 1129 | source += 3; |
1130 | dest += 4; | 1130 | dest += 4; |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | if ((width += 4) <= 0) goto done; | 1133 | if ((width += 4) <= 0) goto done; |
1134 | *dest++ = source[0]; | 1134 | *dest++ = source[0]; |
1135 | if (--width <= 0) goto done; | 1135 | if (--width <= 0) goto done; |
1136 | *dest++ = (1*source[0] + 3*source[1]) >> 2; | 1136 | *dest++ = (1*source[0] + 3*source[1]) >> 2; |
1137 | if (--width <= 0) goto done; | 1137 | if (--width <= 0) goto done; |
1138 | *dest++ = (1*source[1] + 1*source[2]) >> 1; | 1138 | *dest++ = (1*source[1] + 1*source[2]) >> 1; |
1139 | done: | 1139 | done: |
1140 | 1140 | ||
1141 | xine_profiler_stop_count(prof_scale_line); | 1141 | xine_profiler_stop_count(prof_scale_line); |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | 1144 | ||
1145 | /* Interpolate 2 output pixels from one source pixel. */ | 1145 | /* Interpolate 2 output pixels from one source pixel. */ |
1146 | 1146 | ||
1147 | static void scale_line_1_2 (uint8_t *source, uint8_t *dest, | 1147 | static void scale_line_1_2 (uint8_t *source, uint8_t *dest, |
1148 | int width, int step) { | 1148 | int width, int step) { |
1149 | int p1, p2; | 1149 | int p1, p2; |
1150 | 1150 | ||
1151 | xine_profiler_start_count(prof_scale_line); | 1151 | xine_profiler_start_count(prof_scale_line); |
1152 | 1152 | ||
1153 | p1 = *source; | 1153 | p1 = *source; |
1154 | while ((width -= 4) >= 0) { | 1154 | while ((width -= 4) >= 0) { |
1155 | *dest++ = p1; | 1155 | *dest++ = p1; |
1156 | p2 = *++source; | 1156 | p2 = *++source; |
1157 | *dest++ = (p1 + p2) >> 1; | 1157 | *dest++ = (p1 + p2) >> 1; |
1158 | *dest++ = p2; | 1158 | *dest++ = p2; |
1159 | p1 = *++source; | 1159 | p1 = *++source; |
1160 | *dest++ = (p2 + p1) >> 1; | 1160 | *dest++ = (p2 + p1) >> 1; |
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | if ((width += 4) <= 0) goto done; | 1163 | if ((width += 4) <= 0) goto done; |
1164 | *dest++ = source[0]; | 1164 | *dest++ = source[0]; |
1165 | if (--width <= 0) goto done; | 1165 | if (--width <= 0) goto done; |
1166 | *dest++ = (source[0] + source[1]) >> 1; | 1166 | *dest++ = (source[0] + source[1]) >> 1; |
1167 | if (--width <= 0) goto done; | 1167 | if (--width <= 0) goto done; |
1168 | *dest++ = source[1]; | 1168 | *dest++ = source[1]; |
1169 | done: | 1169 | done: |
1170 | 1170 | ||
1171 | xine_profiler_stop_count(prof_scale_line); | 1171 | xine_profiler_stop_count(prof_scale_line); |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | 1174 | ||
1175 | /* | 1175 | /* |
1176 | * Scale line with no horizontal scaling. For NTSC mpeg2 dvd input in | 1176 | * Scale line with no horizontal scaling. For NTSC mpeg2 dvd input in |
1177 | * 4:3 output format (720x480 -> 720x540) | 1177 | * 4:3 output format (720x480 -> 720x540) |
1178 | */ | 1178 | */ |
1179 | static void scale_line_1_1 (uint8_t *source, uint8_t *dest, | 1179 | static void scale_line_1_1 (uint8_t *source, uint8_t *dest, |
1180 | int width, int step) { | 1180 | int width, int step) { |
1181 | 1181 | ||
1182 | xine_profiler_start_count(prof_scale_line); | 1182 | xine_profiler_start_count(prof_scale_line); |
1183 | xine_fast_memcpy(dest, source, width); | 1183 | xine_fast_memcpy(dest, source, width); |
1184 | xine_profiler_stop_count(prof_scale_line); | 1184 | xine_profiler_stop_count(prof_scale_line); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | 1187 | ||
1188 | static scale_line_func_t find_scale_line_func(int step) { | 1188 | static scale_line_func_t find_scale_line_func(int step) { |
1189 | static struct { | 1189 | static struct { |
1190 | int src_step; | 1190 | int src_step; |
1191 | int dest_step; | 1191 | int dest_step; |
1192 | scale_line_func_tfunc; | 1192 | scale_line_func_tfunc; |
1193 | char *desc; | 1193 | char *desc; |
1194 | } scale_line[] = { | 1194 | } scale_line[] = { |
1195 | { 15, 16, scale_line_15_16, "dvd 4:3(pal)" }, | 1195 | { 15, 16, scale_line_15_16, "dvd 4:3(pal)" }, |
1196 | { 45, 64, scale_line_45_64, "dvd 16:9(pal), fullscreen(1024x768)" }, | 1196 | { 45, 64, scale_line_45_64, "dvd 16:9(pal), fullscreen(1024x768)" }, |
1197 | { 9, 16, scale_line_9_16, "dvd fullscreen(1280x1024)" }, | 1197 | { 9, 16, scale_line_9_16, "dvd fullscreen(1280x1024)" }, |
1198 | { 45, 53, scale_line_45_53, "dvd 16:9(ntsc)" }, | 1198 | { 45, 53, scale_line_45_53, "dvd 16:9(ntsc)" }, |
1199 | { 11, 12, scale_line_11_12, "vcd 4:3(pal)" }, | 1199 | { 11, 12, scale_line_11_12, "vcd 4:3(pal)" }, |
1200 | { 11, 24, scale_line_11_24, "vcd 4:3(pal) 2*zoom" }, | 1200 | { 11, 24, scale_line_11_24, "vcd 4:3(pal) 2*zoom" }, |
1201 | { 5, 8, scale_line_5_8, "svcd 4:3(pal)" }, | 1201 | { 5, 8, scale_line_5_8, "svcd 4:3(pal)" }, |
1202 | { 3, 4, scale_line_3_4, "svcd 4:3(ntsc)" }, | 1202 | { 3, 4, scale_line_3_4, "svcd 4:3(ntsc)" }, |
1203 | { 1, 2, scale_line_1_2, "2*zoom" }, | 1203 | { 1, 2, scale_line_1_2, "2*zoom" }, |
1204 | { 1, 1, scale_line_1_1, "non-scaled" }, | 1204 | { 1, 1, scale_line_1_1, "non-scaled" }, |
1205 | }; | 1205 | }; |
1206 | int i; | 1206 | int i; |
1207 | 1207 | ||
1208 | for (i = 0; i < sizeof(scale_line)/sizeof(scale_line[0]); i++) { | 1208 | for (i = 0; i < sizeof(scale_line)/sizeof(scale_line[0]); i++) { |
1209 | if (step == scale_line[i].src_step*32768/scale_line[i].dest_step) { | 1209 | if (step == scale_line[i].src_step*32768/scale_line[i].dest_step) { |
1210 | printf("yuv2rgb: using %s optimized scale_line\n", scale_line[i].desc); | 1210 | //printf("yuv2rgb: using %s optimized scale_line\n", scale_line[i].desc); |
1211 | return scale_line[i].func; | 1211 | return scale_line[i].func; |
1212 | } | 1212 | } |
1213 | } | 1213 | } |
1214 | printf("yuv2rgb: using generic scale_line with interpolation\n"); | 1214 | //printf("yuv2rgb: using generic scale_line with interpolation\n"); |
1215 | return scale_line_gen; | 1215 | return scale_line_gen; |
1216 | 1216 | ||
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | 1219 | ||
1220 | static void scale_line_2 (uint8_t *source, uint8_t *dest, | 1220 | static void scale_line_2 (uint8_t *source, uint8_t *dest, |
1221 | int width, int step) { | 1221 | int width, int step) { |
1222 | int p1; | 1222 | int p1; |
1223 | int p2; | 1223 | int p2; |
1224 | int dx; | 1224 | int dx; |
1225 | 1225 | ||
1226 | p1 = *source; source+=2; | 1226 | p1 = *source; source+=2; |
1227 | p2 = *source; source+=2; | 1227 | p2 = *source; source+=2; |
1228 | dx = 0; | 1228 | dx = 0; |
1229 | 1229 | ||
1230 | while (width) { | 1230 | while (width) { |
1231 | 1231 | ||
1232 | *dest = (p1 * (32768 - dx) + p2 * dx) / 32768; | 1232 | *dest = (p1 * (32768 - dx) + p2 * dx) / 32768; |
1233 | 1233 | ||
1234 | dx += step; | 1234 | dx += step; |
1235 | while (dx > 32768) { | 1235 | while (dx > 32768) { |
1236 | dx -= 32768; | 1236 | dx -= 32768; |
1237 | p1 = p2; | 1237 | p1 = p2; |
1238 | p2 = *source; | 1238 | p2 = *source; |
1239 | source+=2; | 1239 | source+=2; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | dest ++; | 1242 | dest ++; |
1243 | width --; | 1243 | width --; |
1244 | } | 1244 | } |
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | static void scale_line_4 (uint8_t *source, uint8_t *dest, | 1247 | static void scale_line_4 (uint8_t *source, uint8_t *dest, |
1248 | int width, int step) { | 1248 | int width, int step) { |
1249 | int p1; | 1249 | int p1; |
1250 | int p2; | 1250 | int p2; |
1251 | int dx; | 1251 | int dx; |
1252 | 1252 | ||
1253 | p1 = *source; source+=4; | 1253 | p1 = *source; source+=4; |
1254 | p2 = *source; source+=4; | 1254 | p2 = *source; source+=4; |
1255 | dx = 0; | 1255 | dx = 0; |
1256 | 1256 | ||
1257 | while (width) { | 1257 | while (width) { |
1258 | 1258 | ||
1259 | *dest = (p1 * (32768 - dx) + p2 * dx) / 32768; | 1259 | *dest = (p1 * (32768 - dx) + p2 * dx) / 32768; |
1260 | 1260 | ||
1261 | dx += step; | 1261 | dx += step; |
1262 | while (dx > 32768) { | 1262 | while (dx > 32768) { |
1263 | dx -= 32768; | 1263 | dx -= 32768; |
1264 | p1 = p2; | 1264 | p1 = p2; |
1265 | p2 = *source; | 1265 | p2 = *source; |
1266 | source+=4; | 1266 | source+=4; |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | dest ++; | 1269 | dest ++; |
1270 | width --; | 1270 | width --; |
1271 | } | 1271 | } |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | 1274 | ||
1275 | #define RGB(i) \ | 1275 | #define RGB(i) \ |
1276 | U = pu[i]; \ | 1276 | U = pu[i]; \ |
1277 | V = pv[i]; \ | 1277 | V = pv[i]; \ |
1278 | r = this->table_rV[V]; \ | 1278 | r = this->table_rV[V]; \ |
1279 | g = (void *) (((uint8_t *)this->table_gU[U]) + this->table_gV[V]);\ | 1279 | g = (void *) (((uint8_t *)this->table_gU[U]) + this->table_gV[V]);\ |
1280 | b = this->table_bU[U]; | 1280 | b = this->table_bU[U]; |
1281 | 1281 | ||
1282 | #define DST1(i) \ | 1282 | #define DST1(i) \ |
1283 | Y = py_1[2*i]; \ | 1283 | Y = py_1[2*i]; \ |
1284 | dst_1[2*i] = r[Y] + g[Y] + b[Y];\ | 1284 | dst_1[2*i] = r[Y] + g[Y] + b[Y];\ |
1285 | Y = py_1[2*i+1]; \ | 1285 | Y = py_1[2*i+1]; \ |
1286 | dst_1[2*i+1] = r[Y] + g[Y] + b[Y]; | 1286 | dst_1[2*i+1] = r[Y] + g[Y] + b[Y]; |
1287 | 1287 | ||
1288 | #define DST2(i) \ | 1288 | #define DST2(i) \ |
1289 | Y = py_2[2*i]; \ | 1289 | Y = py_2[2*i]; \ |
1290 | dst_2[2*i] = r[Y] + g[Y] + b[Y];\ | 1290 | dst_2[2*i] = r[Y] + g[Y] + b[Y];\ |
1291 | Y = py_2[2*i+1]; \ | 1291 | Y = py_2[2*i+1]; \ |
1292 | dst_2[2*i+1] = r[Y] + g[Y] + b[Y]; | 1292 | dst_2[2*i+1] = r[Y] + g[Y] + b[Y]; |
1293 | 1293 | ||
1294 | #define DST1RGB(i) \ | 1294 | #define DST1RGB(i) \ |
1295 | Y = py_1[2*i]; \ | 1295 | Y = py_1[2*i]; \ |
1296 | dst_1[6*i] = r[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = b[Y];\ | 1296 | dst_1[6*i] = r[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = b[Y];\ |
1297 | Y = py_1[2*i+1]; \ | 1297 | Y = py_1[2*i+1]; \ |
1298 | dst_1[6*i+3] = r[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = b[Y]; | 1298 | dst_1[6*i+3] = r[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = b[Y]; |
1299 | 1299 | ||
1300 | #define DST2RGB(i) \ | 1300 | #define DST2RGB(i) \ |
1301 | Y = py_2[2*i]; \ | 1301 | Y = py_2[2*i]; \ |
1302 | dst_2[6*i] = r[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = b[Y];\ | 1302 | dst_2[6*i] = r[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = b[Y];\ |
1303 | Y = py_2[2*i+1]; \ | 1303 | Y = py_2[2*i+1]; \ |
1304 | dst_2[6*i+3] = r[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = b[Y]; | 1304 | dst_2[6*i+3] = r[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = b[Y]; |
1305 | 1305 | ||
1306 | #define DST1BGR(i) \ | 1306 | #define DST1BGR(i) \ |
1307 | Y = py_1[2*i]; \ | 1307 | Y = py_1[2*i]; \ |
1308 | dst_1[6*i] = b[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = r[Y];\ | 1308 | dst_1[6*i] = b[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = r[Y];\ |
1309 | Y = py_1[2*i+1]; \ | 1309 | Y = py_1[2*i+1]; \ |
1310 | dst_1[6*i+3] = b[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = r[Y]; | 1310 | dst_1[6*i+3] = b[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = r[Y]; |
1311 | 1311 | ||
1312 | #define DST2BGR(i) \ | 1312 | #define DST2BGR(i) \ |
1313 | Y = py_2[2*i]; \ | 1313 | Y = py_2[2*i]; \ |
1314 | dst_2[6*i] = b[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = r[Y];\ | 1314 | dst_2[6*i] = b[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = r[Y];\ |
1315 | Y = py_2[2*i+1]; \ | 1315 | Y = py_2[2*i+1]; \ |
1316 | dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y]; | 1316 | dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y]; |
1317 | 1317 | ||
1318 | #define DST1CMAP(i) \ | 1318 | #define DST1CMAP(i) \ |
1319 | Y = py_1[2*i]; \ | 1319 | Y = py_1[2*i]; \ |
1320 | dst_1[2*i] = this->cmap[r[Y] + g[Y] + b[Y]]; \ | 1320 | dst_1[2*i] = this->cmap[r[Y] + g[Y] + b[Y]]; \ |
1321 | Y = py_1[2*i+1]; \ | 1321 | Y = py_1[2*i+1]; \ |
1322 | dst_1[2*i+1] = this->cmap[r[Y] + g[Y] + b[Y]]; | 1322 | dst_1[2*i+1] = this->cmap[r[Y] + g[Y] + b[Y]]; |
1323 | 1323 | ||
1324 | #define DST2CMAP(i) \ | 1324 | #define DST2CMAP(i) \ |
1325 | Y = py_2[2*i]; \ | 1325 | Y = py_2[2*i]; \ |
1326 | dst_2[2*i] = this->cmap[r[Y] + g[Y] + b[Y]]; \ | 1326 | dst_2[2*i] = this->cmap[r[Y] + g[Y] + b[Y]]; \ |
1327 | Y = py_2[2*i+1]; \ | 1327 | Y = py_2[2*i+1]; \ |
1328 | dst_2[2*i+1] = this->cmap[r[Y] + g[Y] + b[Y]]; | 1328 | dst_2[2*i+1] = this->cmap[r[Y] + g[Y] + b[Y]]; |
1329 | 1329 | ||
1330 | static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, | 1330 | static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, |
1331 | uint8_t * _py, uint8_t * _pu, uint8_t * _pv) | 1331 | uint8_t * _py, uint8_t * _pu, uint8_t * _pv) |
1332 | { | 1332 | { |
1333 | int U, V, Y; | 1333 | int U, V, Y; |
1334 | uint8_t * py_1, * py_2, * pu, * pv; | 1334 | uint8_t * py_1, * py_2, * pu, * pv; |
1335 | uint32_t * r, * g, * b; | 1335 | uint32_t * r, * g, * b; |
1336 | uint32_t * dst_1, * dst_2; | 1336 | uint32_t * dst_1, * dst_2; |
1337 | int width, height, dst_height; | 1337 | int width, height, dst_height; |
1338 | int dy; | 1338 | int dy; |
1339 | 1339 | ||
1340 | if (this->do_scale) { | 1340 | if (this->do_scale) { |
1341 | scale_line_func_t scale_line = this->scale_line; | 1341 | scale_line_func_t scale_line = this->scale_line; |
1342 | 1342 | ||
1343 | scale_line (_pu, this->u_buffer, | 1343 | scale_line (_pu, this->u_buffer, |
1344 | this->dest_width >> 1, this->step_dx); | 1344 | this->dest_width >> 1, this->step_dx); |
1345 | scale_line (_pv, this->v_buffer, | 1345 | scale_line (_pv, this->v_buffer, |
1346 | this->dest_width >> 1, this->step_dx); | 1346 | this->dest_width >> 1, this->step_dx); |
1347 | scale_line (_py, this->y_buffer, | 1347 | scale_line (_py, this->y_buffer, |
1348 | this->dest_width, this->step_dx); | 1348 | this->dest_width, this->step_dx); |
1349 | 1349 | ||
1350 | dy = 0; | 1350 | dy = 0; |
1351 | dst_height = this->dest_height; | 1351 | dst_height = this->dest_height; |
1352 | 1352 | ||
1353 | for (height = 0;; ) { | 1353 | for (height = 0;; ) { |
1354 | dst_1 = (uint32_t*)_dst; | 1354 | dst_1 = (uint32_t*)_dst; |
1355 | py_1 = this->y_buffer; | 1355 | py_1 = this->y_buffer; |
1356 | pu = this->u_buffer; | 1356 | pu = this->u_buffer; |
1357 | pv = this->v_buffer; | 1357 | pv = this->v_buffer; |
1358 | 1358 | ||
1359 | width = this->dest_width >> 3; | 1359 | width = this->dest_width >> 3; |
1360 | 1360 | ||
1361 | do { | 1361 | do { |
1362 | RGB(0); | 1362 | RGB(0); |
1363 | DST1(0); | 1363 | DST1(0); |
1364 | 1364 | ||
1365 | RGB(1); | 1365 | RGB(1); |
1366 | DST1(1); | 1366 | DST1(1); |
1367 | 1367 | ||
1368 | RGB(2); | 1368 | RGB(2); |
1369 | DST1(2); | 1369 | DST1(2); |
1370 | 1370 | ||
1371 | RGB(3); | 1371 | RGB(3); |
1372 | DST1(3); | 1372 | DST1(3); |
1373 | 1373 | ||
1374 | pu += 4; | 1374 | pu += 4; |
1375 | pv += 4; | 1375 | pv += 4; |
1376 | py_1 += 8; | 1376 | py_1 += 8; |
1377 | dst_1 += 8; | 1377 | dst_1 += 8; |
1378 | } while (--width); | 1378 | } while (--width); |
1379 | 1379 | ||
1380 | dy += this->step_dy; | 1380 | dy += this->step_dy; |
1381 | _dst += this->rgb_stride; | 1381 | _dst += this->rgb_stride; |
1382 | 1382 | ||
1383 | while (--dst_height > 0 && dy < 32768) { | 1383 | while (--dst_height > 0 && dy < 32768) { |
1384 | 1384 | ||
1385 | xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4); | 1385 | xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4); |
1386 | 1386 | ||
1387 | dy += this->step_dy; | 1387 | dy += this->step_dy; |
1388 | _dst += this->rgb_stride; | 1388 | _dst += this->rgb_stride; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | if (dst_height <= 0) | 1391 | if (dst_height <= 0) |
1392 | break; | 1392 | break; |
1393 | 1393 | ||
1394 | do { | 1394 | do { |
1395 | dy -= 32768; | 1395 | dy -= 32768; |
1396 | _py += this->y_stride; | 1396 | _py += this->y_stride; |
1397 | 1397 | ||
1398 | scale_line (_py, this->y_buffer, | 1398 | scale_line (_py, this->y_buffer, |
1399 | this->dest_width, this->step_dx); | 1399 | this->dest_width, this->step_dx); |
1400 | 1400 | ||
1401 | if (height & 1) { | 1401 | if (height & 1) { |
1402 | _pu += this->uv_stride; | 1402 | _pu += this->uv_stride; |
1403 | _pv += this->uv_stride; | 1403 | _pv += this->uv_stride; |
1404 | 1404 | ||
1405 | scale_line (_pu, this->u_buffer, | 1405 | scale_line (_pu, this->u_buffer, |
1406 | this->dest_width >> 1, this->step_dx); | 1406 | this->dest_width >> 1, this->step_dx); |
1407 | scale_line (_pv, this->v_buffer, | 1407 | scale_line (_pv, this->v_buffer, |
1408 | this->dest_width >> 1, this->step_dx); | 1408 | this->dest_width >> 1, this->step_dx); |
1409 | 1409 | ||
1410 | } | 1410 | } |
1411 | height++; | 1411 | height++; |
1412 | } while( dy>=32768); | 1412 | } while( dy>=32768); |
1413 | } | 1413 | } |
1414 | } else { | 1414 | } else { |
1415 | height = this->source_height >> 1; | 1415 | height = this->source_height >> 1; |
1416 | do { | 1416 | do { |
1417 | dst_1 = (uint32_t*)_dst; | 1417 | dst_1 = (uint32_t*)_dst; |
1418 | dst_2 = (void*)( (uint8_t *)_dst + this->rgb_stride ); | 1418 | dst_2 = (void*)( (uint8_t *)_dst + this->rgb_stride ); |
1419 | py_1 = _py; | 1419 | py_1 = _py; |
1420 | py_2 = _py + this->y_stride; | 1420 | py_2 = _py + this->y_stride; |
1421 | pu = _pu; | 1421 | pu = _pu; |
1422 | pv = _pv; | 1422 | pv = _pv; |
1423 | 1423 | ||
1424 | width = this->source_width >> 3; | 1424 | width = this->source_width >> 3; |
1425 | do { | 1425 | do { |
1426 | RGB(0); | 1426 | RGB(0); |
1427 | DST1(0); | 1427 | DST1(0); |
1428 | DST2(0); | 1428 | DST2(0); |
1429 | 1429 | ||
1430 | RGB(1); | 1430 | RGB(1); |
1431 | DST2(1); | 1431 | DST2(1); |
1432 | DST1(1); | 1432 | DST1(1); |
1433 | 1433 | ||
1434 | RGB(2); | 1434 | RGB(2); |
1435 | DST1(2); | 1435 | DST1(2); |
1436 | DST2(2); | 1436 | DST2(2); |
1437 | 1437 | ||
1438 | RGB(3); | 1438 | RGB(3); |
1439 | DST2(3); | 1439 | DST2(3); |
1440 | DST1(3); | 1440 | DST1(3); |
1441 | 1441 | ||
1442 | pu += 4; | 1442 | pu += 4; |
1443 | pv += 4; | 1443 | pv += 4; |
1444 | py_1 += 8; | 1444 | py_1 += 8; |
1445 | py_2 += 8; | 1445 | py_2 += 8; |
1446 | dst_1 += 8; | 1446 | dst_1 += 8; |
1447 | dst_2 += 8; | 1447 | dst_2 += 8; |
1448 | } while (--width); | 1448 | } while (--width); |
1449 | 1449 | ||
1450 | _dst += 2 * this->rgb_stride; | 1450 | _dst += 2 * this->rgb_stride; |
1451 | _py += 2 * this->y_stride; | 1451 | _py += 2 * this->y_stride; |
1452 | _pu += this->uv_stride; | 1452 | _pu += this->uv_stride; |
1453 | _pv += this->uv_stride; | 1453 | _pv += this->uv_stride; |
1454 | 1454 | ||
1455 | } while (--height); | 1455 | } while (--height); |
1456 | } | 1456 | } |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | /* This is very near from the yuv2rgb_c_32 code */ | 1459 | /* This is very near from the yuv2rgb_c_32 code */ |
1460 | static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, | 1460 | static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, |
1461 | uint8_t * _py, uint8_t * _pu, uint8_t * _pv) | 1461 | uint8_t * _py, uint8_t * _pu, uint8_t * _pv) |
1462 | { | 1462 | { |
1463 | int U, V, Y; | 1463 | int U, V, Y; |
1464 | uint8_t * py_1, * py_2, * pu, * pv; | 1464 | uint8_t * py_1, * py_2, * pu, * pv; |
1465 | uint8_t * r, * g, * b; | 1465 | uint8_t * r, * g, * b; |
1466 | uint8_t * dst_1, * dst_2; | 1466 | uint8_t * dst_1, * dst_2; |
1467 | int width, height, dst_height; | 1467 | int width, height, dst_height; |
1468 | int dy; | 1468 | int dy; |
1469 | 1469 | ||
1470 | if (this->do_scale) { | 1470 | if (this->do_scale) { |