diff options
-rw-r--r-- | firmware/target/hosted/android/lcd-android.c | 205 |
1 files changed, 0 insertions, 205 deletions
diff --git a/firmware/target/hosted/android/lcd-android.c b/firmware/target/hosted/android/lcd-android.c index c9a3fd6edf..4e4ea66268 100644 --- a/firmware/target/hosted/android/lcd-android.c +++ b/firmware/target/hosted/android/lcd-android.c | |||
@@ -158,208 +158,3 @@ int touchscreen_get_scroll_threshold(void) | |||
158 | { | 158 | { |
159 | return scroll_threshold; | 159 | return scroll_threshold; |
160 | } | 160 | } |
161 | |||
162 | /* below is a plain copy from lcd-sdl.c */ | ||
163 | |||
164 | /** | ||
165 | * |R| |1.000000 -0.000001 1.402000| |Y'| | ||
166 | * |G| = |1.000000 -0.334136 -0.714136| |Pb| | ||
167 | * |B| |1.000000 1.772000 0.000000| |Pr| | ||
168 | * Scaled, normalized, rounded and tweaked to yield RGB 565: | ||
169 | * |R| |74 0 101| |Y' - 16| >> 9 | ||
170 | * |G| = |74 -24 -51| |Cb - 128| >> 8 | ||
171 | * |B| |74 128 0| |Cr - 128| >> 9 | ||
172 | */ | ||
173 | #define YFAC (74) | ||
174 | #define RVFAC (101) | ||
175 | #define GUFAC (-24) | ||
176 | #define GVFAC (-51) | ||
177 | #define BUFAC (128) | ||
178 | |||
179 | static inline int clamp(int val, int min, int max) | ||
180 | { | ||
181 | if (val < min) | ||
182 | val = min; | ||
183 | else if (val > max) | ||
184 | val = max; | ||
185 | return val; | ||
186 | } | ||
187 | |||
188 | void lcd_yuv_set_options(unsigned options) | ||
189 | { | ||
190 | (void)options; | ||
191 | } | ||
192 | |||
193 | /* Draw a partial YUV colour bitmap - similiar behavior to lcd_blit_yuv | ||
194 | in the core */ | ||
195 | void lcd_blit_yuv(unsigned char * const src[3], | ||
196 | int src_x, int src_y, int stride, | ||
197 | int x, int y, int width, int height) | ||
198 | { | ||
199 | const unsigned char *ysrc, *usrc, *vsrc; | ||
200 | int linecounter; | ||
201 | fb_data *dst, *row_end; | ||
202 | long z; | ||
203 | |||
204 | /* width and height must be >= 2 and an even number */ | ||
205 | width &= ~1; | ||
206 | linecounter = height >> 1; | ||
207 | |||
208 | #if LCD_WIDTH >= LCD_HEIGHT | ||
209 | dst = FBADDR(x,y); | ||
210 | row_end = dst + width; | ||
211 | #else | ||
212 | dst = FBADDR(LCD_WIDTH - y - 1,x); | ||
213 | row_end = dst + LCD_WIDTH * width; | ||
214 | #endif | ||
215 | |||
216 | z = stride * src_y; | ||
217 | ysrc = src[0] + z + src_x; | ||
218 | usrc = src[1] + (z >> 2) + (src_x >> 1); | ||
219 | vsrc = src[2] + (usrc - src[1]); | ||
220 | |||
221 | /* stride => amount to jump from end of last row to start of next */ | ||
222 | stride -= width; | ||
223 | |||
224 | /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */ | ||
225 | |||
226 | do | ||
227 | { | ||
228 | do | ||
229 | { | ||
230 | int y, cb, cr, rv, guv, bu, r, g, b; | ||
231 | |||
232 | y = YFAC*(*ysrc++ - 16); | ||
233 | cb = *usrc++ - 128; | ||
234 | cr = *vsrc++ - 128; | ||
235 | |||
236 | rv = RVFAC*cr; | ||
237 | guv = GUFAC*cb + GVFAC*cr; | ||
238 | bu = BUFAC*cb; | ||
239 | |||
240 | r = y + rv; | ||
241 | g = y + guv; | ||
242 | b = y + bu; | ||
243 | |||
244 | if ((unsigned)(r | g | b) > 64*256-1) | ||
245 | { | ||
246 | r = clamp(r, 0, 64*256-1); | ||
247 | g = clamp(g, 0, 64*256-1); | ||
248 | b = clamp(b, 0, 64*256-1); | ||
249 | } | ||
250 | |||
251 | *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); | ||
252 | |||
253 | #if LCD_WIDTH >= LCD_HEIGHT | ||
254 | dst++; | ||
255 | #else | ||
256 | dst += LCD_WIDTH; | ||
257 | #endif | ||
258 | |||
259 | y = YFAC*(*ysrc++ - 16); | ||
260 | r = y + rv; | ||
261 | g = y + guv; | ||
262 | b = y + bu; | ||
263 | |||
264 | if ((unsigned)(r | g | b) > 64*256-1) | ||
265 | { | ||
266 | r = clamp(r, 0, 64*256-1); | ||
267 | g = clamp(g, 0, 64*256-1); | ||
268 | b = clamp(b, 0, 64*256-1); | ||
269 | } | ||
270 | |||
271 | *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); | ||
272 | |||
273 | #if LCD_WIDTH >= LCD_HEIGHT | ||
274 | dst++; | ||
275 | #else | ||
276 | dst += LCD_WIDTH; | ||
277 | #endif | ||
278 | } | ||
279 | while (dst < row_end); | ||
280 | |||
281 | ysrc += stride; | ||
282 | usrc -= width >> 1; | ||
283 | vsrc -= width >> 1; | ||
284 | |||
285 | #if LCD_WIDTH >= LCD_HEIGHT | ||
286 | row_end += LCD_WIDTH; | ||
287 | dst += LCD_WIDTH - width; | ||
288 | #else | ||
289 | row_end -= 1; | ||
290 | dst -= LCD_WIDTH*width + 1; | ||
291 | #endif | ||
292 | |||
293 | do | ||
294 | { | ||
295 | int y, cb, cr, rv, guv, bu, r, g, b; | ||
296 | |||
297 | y = YFAC*(*ysrc++ - 16); | ||
298 | cb = *usrc++ - 128; | ||
299 | cr = *vsrc++ - 128; | ||
300 | |||
301 | rv = RVFAC*cr; | ||
302 | guv = GUFAC*cb + GVFAC*cr; | ||
303 | bu = BUFAC*cb; | ||
304 | |||
305 | r = y + rv; | ||
306 | g = y + guv; | ||
307 | b = y + bu; | ||
308 | |||
309 | if ((unsigned)(r | g | b) > 64*256-1) | ||
310 | { | ||
311 | r = clamp(r, 0, 64*256-1); | ||
312 | g = clamp(g, 0, 64*256-1); | ||
313 | b = clamp(b, 0, 64*256-1); | ||
314 | } | ||
315 | |||
316 | *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); | ||
317 | |||
318 | #if LCD_WIDTH >= LCD_HEIGHT | ||
319 | dst++; | ||
320 | #else | ||
321 | dst += LCD_WIDTH; | ||
322 | #endif | ||
323 | |||
324 | y = YFAC*(*ysrc++ - 16); | ||
325 | r = y + rv; | ||
326 | g = y + guv; | ||
327 | b = y + bu; | ||
328 | |||
329 | if ((unsigned)(r | g | b) > 64*256-1) | ||
330 | { | ||
331 | r = clamp(r, 0, 64*256-1); | ||
332 | g = clamp(g, 0, 64*256-1); | ||
333 | b = clamp(b, 0, 64*256-1); | ||
334 | } | ||
335 | |||
336 | *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); | ||
337 | |||
338 | #if LCD_WIDTH >= LCD_HEIGHT | ||
339 | dst++; | ||
340 | #else | ||
341 | dst += LCD_WIDTH; | ||
342 | #endif | ||
343 | } | ||
344 | while (dst < row_end); | ||
345 | |||
346 | ysrc += stride; | ||
347 | usrc += stride >> 1; | ||
348 | vsrc += stride >> 1; | ||
349 | |||
350 | #if LCD_WIDTH >= LCD_HEIGHT | ||
351 | row_end += LCD_WIDTH; | ||
352 | dst += LCD_WIDTH - width; | ||
353 | #else | ||
354 | row_end -= 1; | ||
355 | dst -= LCD_WIDTH*width + 1; | ||
356 | #endif | ||
357 | } | ||
358 | while (--linecounter > 0); | ||
359 | |||
360 | #if LCD_WIDTH >= LCD_HEIGHT | ||
361 | lcd_update_rect(x, y, width, height); | ||
362 | #else | ||
363 | lcd_update_rect(LCD_WIDTH - y - height, x, height, width); | ||
364 | #endif | ||
365 | } | ||