summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/recorder/bmp.c65
1 files changed, 42 insertions, 23 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index 7b6f6291c8..3db2cb1817 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -110,9 +110,10 @@ static const unsigned char dither_matrix[16][16] = {
110}; 110};
111#endif 111#endif
112 112
113#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH == 2) \ 113#if ((LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)) \
114 && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) 114 || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH == 2) \
115static const fb_remote_data remote_pattern[4] = { 115 && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED))
116static const unsigned short vi_pattern[4] = {
116 0x0101, 0x0100, 0x0001, 0x0000 117 0x0101, 0x0100, 0x0001, 0x0000
117}; 118};
118#endif 119#endif
@@ -271,12 +272,15 @@ int read_bmp_fd(int fd,
271#endif /* defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 */ 272#endif /* defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 */
272 { 273 {
273#if LCD_DEPTH == 2 274#if LCD_DEPTH == 2
274#if LCD_PIXELFORMAT == VERTICAL_PACKING 275#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
275 dst_width = width;
276 dst_height = (height + 3) >> 2;
277#else /* LCD_PIXELFORMAT == HORIZONTAL_PACKING */
278 dst_width = (width + 3) >> 2; 276 dst_width = (width + 3) >> 2;
279 dst_height = height; 277 dst_height = height;
278#elif LCD_PIXELFORMAT == VERTICAL_PACKING
279 dst_width = width;
280 dst_height = (height + 3) >> 2;
281#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
282 dst_width = width;
283 dst_height = (height + 7) >> 3;
280#endif /* LCD_PIXELFORMAT */ 284#endif /* LCD_PIXELFORMAT */
281#elif LCD_DEPTH == 16 285#elif LCD_DEPTH == 16
282 dst_width = width; 286 dst_width = width;
@@ -475,6 +479,7 @@ int read_bmp_fd(int fd,
475#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 479#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
476 if (remote) { 480 if (remote) {
477#if (LCD_REMOTE_DEPTH == 2) && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) 481#if (LCD_REMOTE_DEPTH == 2) && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED)
482 /* iAudio X5/M5 remote */
478 fb_remote_data *dest = (fb_remote_data *)bitmap 483 fb_remote_data *dest = (fb_remote_data *)bitmap
479 + dst_width * (row >> 3); 484 + dst_width * (row >> 3);
480 int shift = row & 7; 485 int shift = row & 7;
@@ -486,28 +491,14 @@ int read_bmp_fd(int fd,
486 delta = dither_matrix[row & 0xf][col & 0xf]; 491 delta = dither_matrix[row & 0xf][col & 0xf];
487 bright = brightness(*qp++); 492 bright = brightness(*qp++);
488 bright = (3 * bright + (bright >> 6) + delta) >> 8; 493 bright = (3 * bright + (bright >> 6) + delta) >> 8;
489 *dest++ |= remote_pattern[bright] << shift; 494 *dest++ |= vi_pattern[bright] << shift;
490 } 495 }
491#endif /* LCD_REMOTE_DEPTH / LCD_REMOTE_PIXELFORMAT */ 496#endif /* LCD_REMOTE_DEPTH / LCD_REMOTE_PIXELFORMAT */
492 } else 497 } else
493#endif /* defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 */ 498#endif /* defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 */
494 { 499 {
495#if LCD_DEPTH == 2 500#if LCD_DEPTH == 2
496#if LCD_PIXELFORMAT == VERTICAL_PACKING 501#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
497 /* iriver H1x0 */
498 fb_data *dest = (fb_data *)bitmap + dst_width * (row >> 2);
499 int shift = 2 * (row & 3);
500 int delta = 127;
501 unsigned bright;
502
503 for (col = 0; col < width; col++) {
504 if (dither)
505 delta = dither_matrix[row & 0xf][col & 0xf];
506 bright = brightness(*qp++);
507 bright = (3 * bright + (bright >> 6) + delta) >> 8;
508 *dest++ |= (~bright & 3) << shift;
509 }
510#else /* LCD_PIXELFORMAT == HORIZONTAL_PACKING */
511 /* greyscale iPods */ 502 /* greyscale iPods */
512 fb_data *dest = (fb_data *)bitmap + dst_width * row; 503 fb_data *dest = (fb_data *)bitmap + dst_width * row;
513 int shift = 6; 504 int shift = 6;
@@ -530,6 +521,34 @@ int read_bmp_fd(int fd,
530 } 521 }
531 if (shift < 6) 522 if (shift < 6)
532 *dest++ = data; 523 *dest++ = data;
524#elif LCD_PIXELFORMAT == VERTICAL_PACKING
525 /* iriver H1x0 */
526 fb_data *dest = (fb_data *)bitmap + dst_width * (row >> 2);
527 int shift = 2 * (row & 3);
528 int delta = 127;
529 unsigned bright;
530
531 for (col = 0; col < width; col++) {
532 if (dither)
533 delta = dither_matrix[row & 0xf][col & 0xf];
534 bright = brightness(*qp++);
535 bright = (3 * bright + (bright >> 6) + delta) >> 8;
536 *dest++ |= (~bright & 3) << shift;
537 }
538#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
539 /* iAudio M3 */
540 fb_data *dest = (fb_data *)bitmap + dst_width * (row >> 3);
541 int shift = row & 7;
542 int delta = 127;
543 unsigned bright;
544
545 for (col = 0; col < width; col++) {
546 if (dither)
547 delta = dither_matrix[row & 0xf][col & 0xf];
548 bright = brightness(*qp++);
549 bright = (3 * bright + (bright >> 6) + delta) >> 8;
550 *dest++ |= vi_pattern[bright] << shift;
551 }
533#endif /* LCD_PIXELFORMAT */ 552#endif /* LCD_PIXELFORMAT */
534#elif LCD_DEPTH == 16 553#elif LCD_DEPTH == 16
535 /* iriver h300, colour iPods, X5 */ 554 /* iriver h300, colour iPods, X5 */