summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/bmp.c17
-rw-r--r--apps/recorder/resize.c12
2 files changed, 21 insertions, 8 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index a6d6dd71b1..a9cc34b2c6 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -455,7 +455,7 @@ void output_row_8_native(uint32_t row, void * row_in,
455 *dest++ |= vi_pattern[bright] << shift; 455 *dest++ |= vi_pattern[bright] << shift;
456 } 456 }
457#endif /* LCD_PIXELFORMAT */ 457#endif /* LCD_PIXELFORMAT */
458#elif LCD_DEPTH == 16 458#elif LCD_DEPTH >= 16
459 /* iriver h300, colour iPods, X5 */ 459 /* iriver h300, colour iPods, X5 */
460 (void)fb_width; 460 (void)fb_width;
461 fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row, 461 fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row,
@@ -470,15 +470,18 @@ void output_row_8_native(uint32_t row, void * row_in,
470 bm_alpha += ALIGN_UP(ctx->bm->width, 2) * row/2; 470 bm_alpha += ALIGN_UP(ctx->bm->width, 2) * row/2;
471 471
472 for (col = 0; col < ctx->bm->width; col++) { 472 for (col = 0; col < ctx->bm->width; col++) {
473 (void) delta;
473 if (ctx->dither) 474 if (ctx->dither)
474 delta = DITHERXDY(col,dy); 475 delta = DITHERXDY(col,dy);
475 r = qp->red; 476 r = qp->red;
476 g = qp->green; 477 g = qp->green;
477 b = qp->blue; 478 b = qp->blue;
479#if LCD_DEPTH < 24
478 r = (31 * r + (r >> 3) + delta) >> 8; 480 r = (31 * r + (r >> 3) + delta) >> 8;
479 g = (63 * g + (g >> 2) + delta) >> 8; 481 g = (63 * g + (g >> 2) + delta) >> 8;
480 b = (31 * b + (b >> 3) + delta) >> 8; 482 b = (31 * b + (b >> 3) + delta) >> 8;
481 *dest = LCD_RGBPACK_LCD(r, g, b); 483#endif
484 *dest = FB_RGBPACK_LCD(r, g, b);
482 dest += STRIDE_MAIN(1, ctx->bm->height); 485 dest += STRIDE_MAIN(1, ctx->bm->height);
483 if (bm_alpha) { 486 if (bm_alpha) {
484 /* pack alpha channel for 2 pixels into 1 byte and negate 487 /* pack alpha channel for 2 pixels into 1 byte and negate
@@ -526,8 +529,8 @@ int read_bmp_fd(int fd,
526 bool dither = false; 529 bool dither = false;
527#endif 530#endif
528 531
529#ifdef HAVE_REMOTE_LCD
530 bool remote = false; 532 bool remote = false;
533#ifdef HAVE_REMOTE_LCD
531 if (format & FORMAT_REMOTE) { 534 if (format & FORMAT_REMOTE) {
532 remote = true; 535 remote = true;
533#if LCD_REMOTE_DEPTH == 1 536#if LCD_REMOTE_DEPTH == 1
@@ -710,9 +713,7 @@ int read_bmp_fd(int fd,
710 case 16: 713 case 16:
711#if LCD_DEPTH >= 16 714#if LCD_DEPTH >= 16
712 /* don't dither 16 bit BMP to LCD with same or larger depth */ 715 /* don't dither 16 bit BMP to LCD with same or larger depth */
713#ifdef HAVE_REMOTE_LCD
714 if (!remote) 716 if (!remote)
715#endif
716 dither = false; 717 dither = false;
717#endif 718#endif
718 if (compression == 0) { /* BI_RGB, i.e. 15 bit */ 719 if (compression == 0) { /* BI_RGB, i.e. 15 bit */
@@ -755,6 +756,12 @@ int read_bmp_fd(int fd,
755 break; 756 break;
756 } 757 }
757 758
759#if LCD_DEPTH >= 24
760 /* Never dither 24/32 bit BMP to 24 bit LCDs */
761 if (depth >= 24 && !remote)
762 dither = false;
763#endif
764
758 /* Search to the beginning of the image data */ 765 /* Search to the beginning of the image data */
759 lseek(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET); 766 lseek(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET);
760 767
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c
index 32384537d4..ac6b7a3120 100644
--- a/apps/recorder/resize.c
+++ b/apps/recorder/resize.c
@@ -680,6 +680,7 @@ static void output_row_32_native_fromyuv(uint32_t row, void * row_in,
680 unsigned r, g, b, y, u, v; 680 unsigned r, g, b, y, u, v;
681 681
682 for (col = 0; col < ctx->bm->width; col++) { 682 for (col = 0; col < ctx->bm->width; col++) {
683 (void) delta;
683 if (ctx->dither) 684 if (ctx->dither)
684 delta = DITHERXDY(col,dy); 685 delta = DITHERXDY(col,dy);
685 y = SC_OUT(qp->b, ctx); 686 y = SC_OUT(qp->b, ctx);
@@ -687,10 +688,12 @@ static void output_row_32_native_fromyuv(uint32_t row, void * row_in,
687 v = SC_OUT(qp->r, ctx); 688 v = SC_OUT(qp->r, ctx);
688 qp++; 689 qp++;
689 yuv_to_rgb(y, u, v, &r, &g, &b); 690 yuv_to_rgb(y, u, v, &r, &g, &b);
691#if LCD_DEPTH < 24
690 r = (31 * r + (r >> 3) + delta) >> 8; 692 r = (31 * r + (r >> 3) + delta) >> 8;
691 g = (63 * g + (g >> 2) + delta) >> 8; 693 g = (63 * g + (g >> 2) + delta) >> 8;
692 b = (31 * b + (b >> 3) + delta) >> 8; 694 b = (31 * b + (b >> 3) + delta) >> 8;
693 *dest = LCD_RGBPACK_LCD(r, g, b); 695#endif
696 *dest = FB_RGBPACK_LCD(r, g, b);
694 dest += DEST_STEP; 697 dest += DEST_STEP;
695 } 698 }
696} 699}
@@ -764,7 +767,7 @@ static void output_row_32_native(uint32_t row, void * row_in,
764 *dest++ |= vi_pattern[bright] << shift; 767 *dest++ |= vi_pattern[bright] << shift;
765 } 768 }
766#endif /* LCD_PIXELFORMAT */ 769#endif /* LCD_PIXELFORMAT */
767#elif LCD_DEPTH == 16 770#elif LCD_DEPTH >= 16
768 /* iriver h300, colour iPods, X5 */ 771 /* iriver h300, colour iPods, X5 */
769 (void)fb_width; 772 (void)fb_width;
770 fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row, 773 fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row,
@@ -780,16 +783,19 @@ static void output_row_32_native(uint32_t row, void * row_in,
780 bm_alpha += ALIGN_UP(ctx->bm->width, 2)*row/2; 783 bm_alpha += ALIGN_UP(ctx->bm->width, 2)*row/2;
781 784
782 for (col = 0; col < ctx->bm->width; col++) { 785 for (col = 0; col < ctx->bm->width; col++) {
786 (void) delta;
783 if (ctx->dither) 787 if (ctx->dither)
784 delta = DITHERXDY(col,dy); 788 delta = DITHERXDY(col,dy);
785 q0 = *qp++; 789 q0 = *qp++;
786 r = SC_OUT(q0.r, ctx); 790 r = SC_OUT(q0.r, ctx);
787 g = SC_OUT(q0.g, ctx); 791 g = SC_OUT(q0.g, ctx);
788 b = SC_OUT(q0.b, ctx); 792 b = SC_OUT(q0.b, ctx);
793#if LCD_DEPTH < 24
789 r = (31 * r + (r >> 3) + delta) >> 8; 794 r = (31 * r + (r >> 3) + delta) >> 8;
790 g = (63 * g + (g >> 2) + delta) >> 8; 795 g = (63 * g + (g >> 2) + delta) >> 8;
791 b = (31 * b + (b >> 3) + delta) >> 8; 796 b = (31 * b + (b >> 3) + delta) >> 8;
792 *dest = LCD_RGBPACK_LCD(r, g, b); 797#endif
798 *dest = FB_RGBPACK_LCD(r, g, b);
793 dest += STRIDE_MAIN(1, ctx->bm->height); 799 dest += STRIDE_MAIN(1, ctx->bm->height);
794 if (bm_alpha) { 800 if (bm_alpha) {
795 /* pack alpha channel for 2 pixels into 1 byte */ 801 /* pack alpha channel for 2 pixels into 1 byte */