summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/video_out_rockbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mpegplayer/video_out_rockbox.c')
-rw-r--r--apps/plugins/mpegplayer/video_out_rockbox.c204
1 files changed, 0 insertions, 204 deletions
diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c
index b57f77bc0a..2aac0b8039 100644
--- a/apps/plugins/mpegplayer/video_out_rockbox.c
+++ b/apps/plugins/mpegplayer/video_out_rockbox.c
@@ -40,216 +40,12 @@ static int output_y;
40static int output_width; 40static int output_width;
41static int output_height; 41static int output_height;
42 42
43#if defined(SIMULATOR) && defined(HAVE_LCD_COLOR)
44
45/**
46 * |R| |1.000000 -0.000001 1.402000| |Y'|
47 * |G| = |1.000000 -0.334136 -0.714136| |Pb|
48 * |B| |1.000000 1.772000 0.000000| |Pr|
49 * Scaled, normalized, rounded and tweaked to yield RGB 565:
50 * |R| |74 0 101| |Y' - 16| >> 9
51 * |G| = |74 -24 -51| |Cb - 128| >> 8
52 * |B| |74 128 0| |Cr - 128| >> 9
53 */
54#define YFAC (74)
55#define RVFAC (101)
56#define GUFAC (-24)
57#define GVFAC (-51)
58#define BUFAC (128)
59
60static inline int clamp(int val, int min, int max)
61{
62 if (val < min)
63 val = min;
64 else if (val > max)
65 val = max;
66 return val;
67}
68
69/* Draw a partial YUV colour bitmap - similiar behavior to lcd_yuv_blit
70 in the core */
71static void yuv_bitmap_part(unsigned char * const src[3],
72 int src_x, int src_y, int stride,
73 int x, int y, int width, int height)
74{
75 const unsigned char *ysrc, *usrc, *vsrc;
76 fb_data *dst, *row_end;
77 off_t z;
78
79 /* width and height must be >= 2 and an even number */
80 width &= ~1;
81 height >>= 1;
82
83#if LCD_WIDTH >= LCD_HEIGHT
84 dst = rb->lcd_framebuffer + LCD_WIDTH * y + x;
85 row_end = dst + width;
86#else
87 dst = rb->lcd_framebuffer + x * LCD_WIDTH + (LCD_WIDTH - y) - 1;
88 row_end = dst + LCD_WIDTH * width;
89#endif
90
91 z = stride * src_y;
92 ysrc = src[0] + z + src_x;
93 usrc = src[1] + (z >> 2) + (src_x >> 1);
94 vsrc = src[2] + (usrc - src[1]);
95
96 /* stride => amount to jump from end of last row to start of next */
97 stride -= width;
98
99 /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
100
101 do
102 {
103 do
104 {
105 int y, cb, cr, rv, guv, bu, r, g, b;
106
107 y = YFAC*(*ysrc++ - 16);
108 cb = *usrc++ - 128;
109 cr = *vsrc++ - 128;
110
111 rv = RVFAC*cr;
112 guv = GUFAC*cb + GVFAC*cr;
113 bu = BUFAC*cb;
114
115 r = y + rv;
116 g = y + guv;
117 b = y + bu;
118
119 if ((unsigned)(r | g | b) > 64*256-1)
120 {
121 r = clamp(r, 0, 64*256-1);
122 g = clamp(g, 0, 64*256-1);
123 b = clamp(b, 0, 64*256-1);
124 }
125
126 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
127
128#if LCD_WIDTH >= LCD_HEIGHT
129 dst++;
130#else
131 dst += LCD_WIDTH;
132#endif
133
134 y = YFAC*(*ysrc++ - 16);
135 r = y + rv;
136 g = y + guv;
137 b = y + bu;
138
139 if ((unsigned)(r | g | b) > 64*256-1)
140 {
141 r = clamp(r, 0, 64*256-1);
142 g = clamp(g, 0, 64*256-1);
143 b = clamp(b, 0, 64*256-1);
144 }
145
146 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
147
148#if LCD_WIDTH >= LCD_HEIGHT
149 dst++;
150#else
151 dst += LCD_WIDTH;
152#endif
153 }
154 while (dst < row_end);
155
156 ysrc += stride;
157 usrc -= width >> 1;
158 vsrc -= width >> 1;
159
160#if LCD_WIDTH >= LCD_HEIGHT
161 row_end += LCD_WIDTH;
162 dst += LCD_WIDTH - width;
163#else
164 row_end -= 1;
165 dst -= LCD_WIDTH*width + 1;
166#endif
167
168 do
169 {
170 int y, cb, cr, rv, guv, bu, r, g, b;
171
172 y = YFAC*(*ysrc++ - 16);
173 cb = *usrc++ - 128;
174 cr = *vsrc++ - 128;
175
176 rv = RVFAC*cr;
177 guv = GUFAC*cb + GVFAC*cr;
178 bu = BUFAC*cb;
179
180 r = y + rv;
181 g = y + guv;
182 b = y + bu;
183
184 if ((unsigned)(r | g | b) > 64*256-1)
185 {
186 r = clamp(r, 0, 64*256-1);
187 g = clamp(g, 0, 64*256-1);
188 b = clamp(b, 0, 64*256-1);
189 }
190
191 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
192
193#if LCD_WIDTH >= LCD_HEIGHT
194 dst++;
195#else
196 dst += LCD_WIDTH;
197#endif
198
199 y = YFAC*(*ysrc++ - 16);
200 r = y + rv;
201 g = y + guv;
202 b = y + bu;
203
204 if ((unsigned)(r | g | b) > 64*256-1)
205 {
206 r = clamp(r, 0, 64*256-1);
207 g = clamp(g, 0, 64*256-1);
208 b = clamp(b, 0, 64*256-1);
209 }
210
211 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
212
213#if LCD_WIDTH >= LCD_HEIGHT
214 dst++;
215#else
216 dst += LCD_WIDTH;
217#endif
218 }
219 while (dst < row_end);
220
221 ysrc += stride;
222 usrc += stride >> 1;
223 vsrc += stride >> 1;
224
225#if LCD_WIDTH >= LCD_HEIGHT
226 row_end += LCD_WIDTH;
227 dst += LCD_WIDTH - width;
228#else
229 row_end -= 1;
230 dst -= LCD_WIDTH*width + 1;
231#endif
232 }
233 while (--height > 0);
234}
235#endif /* defined(SIMULATOR) && defined(HAVE_LCD_COLOR) */
236
237void vo_draw_frame (uint8_t * const * buf) 43void vo_draw_frame (uint8_t * const * buf)
238{ 44{
239#ifdef HAVE_LCD_COLOR 45#ifdef HAVE_LCD_COLOR
240#ifdef SIMULATOR
241 yuv_bitmap_part(buf,0,0,image_width,
242 output_x,output_y,output_width,output_height);
243#if LCD_WIDTH >= LCD_HEIGHT
244 rb->lcd_update_rect(output_x,output_y,output_width,output_height);
245#else
246 rb->lcd_update_rect(output_y,output_x,output_height,output_width);
247#endif
248#else
249 rb->lcd_yuv_blit(buf, 46 rb->lcd_yuv_blit(buf,
250 0,0,image_width, 47 0,0,image_width,
251 output_x,output_y,output_width,output_height); 48 output_x,output_y,output_width,output_height);
252#endif
253#else 49#else
254 gray_ub_gray_bitmap_part(buf[0],0,0,image_width, 50 gray_ub_gray_bitmap_part(buf[0],0,0,image_width,
255 output_x,output_y,output_width,output_height); 51 output_x,output_y,output_width,output_height);