Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 |
diff --git a/apps/SOURCES b/apps/SOURCES index 13ca913..62bb78a 100644 @@ -88,8 +88,6 @@ gui/viewport.c #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) gui/backdrop.c -recorder/resize.c -recorder/jpeg_load.c #endif #ifdef HAVE_LCD_CHARCELLS @@ -101,6 +99,12 @@ recorder/bmp.c recorder/icons.c recorder/keyboard.c recorder/peakmeter.c +#if defined(HAVE_ALBUMART) || defined(HAVE_JPEG) +recorder/resize.c +#endif +#ifdef HAVE_JPEG +recorder/jpeg_load.c +#endif #ifdef HAVE_ALBUMART recorder/albumart.c #endif diff --git a/apps/buffering.c b/apps/buffering.c index 66bd22f..3bcd790 100644 @@ -834,7 +834,6 @@ static bool fill_buffer(void) static int load_image(int fd, const char *path) { int rc; - int pathlen = strlen(path); struct bitmap *bmp = (struct bitmap *)&buffer[buf_widx]; /* FIXME: alignment may be needed for the data buffer. */ bmp->data = &buffer[buf_widx + sizeof(struct bitmap)]; @@ -848,10 +847,13 @@ static int load_image(int fd, const char *path) get_albumart_size(bmp); +#ifdef HAVE_JPEG + int pathlen = strlen(path); if (strcmp(path + pathlen - 4, ".bmp")) rc = read_jpeg_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER| FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL); else +#endif rc = read_bmp_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER| FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL); return rc + (rc > 0 ? sizeof(struct bitmap) : 0); diff --git a/apps/plugin.c b/apps/plugin.c index 33a6194..2d996a4 100644 @@ -644,7 +644,7 @@ static const struct plugin_api rockbox_api = { #endif #endif #ifdef HAVE_LCD_BITMAP -#if LCD_DEPTH > 1 +#ifdef HAVE_JPEG read_jpeg_file, read_jpeg_fd, #endif diff --git a/apps/plugin.h b/apps/plugin.h index 19eb962..72d71b6 100644 @@ -805,7 +805,7 @@ struct plugin_api { #endif #ifdef HAVE_LCD_BITMAP -#if LCD_DEPTH > 1 +#ifdef HAVE_JPEG int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize, int format, const struct custom_format *cformat); int (*read_jpeg_fd)(int fd, struct bitmap *bm, int maxsize, diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index dfdd569..dc4d41c 100644 @@ -5,15 +5,13 @@ fixedpoint.c playback_control.c rgb_hsv.c buflib.c -#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) -/* - The scaler is not provided in core on mono targets, but is built in - pluginlib for use with greylib overlay output -*/ -#if LCD_DEPTH == 1 +#if !defined(HAVE_BMP_SCALING) || !defined(HAVE_JPEG) pluginlib_resize.c +#endif +#ifndef HAVE_JPEG pluginlib_jpeg_load.c #endif +#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) grey_core.c grey_draw.c grey_parm.c @@ -45,7 +43,7 @@ read_image.c #ifdef HAVE_LCD_COLOR bmp_smooth_scale.c #endif -#ifndef HAVE_ALBUMART +#if !defined(HAVE_ALBUMART) || !defined(HAVE_JPEG) pluginlib_albumart.c #endif #endif diff --git a/apps/plugins/lib/feature_wrappers.h b/apps/plugins/lib/feature_wrappers.h index 3f47f23..50552fb 100644 * but can easily be implement in pluginlib as long as the database is * available. */ -#ifdef HAVE_ALBUMART +#if defined(HAVE_ALBUMART) && defined(HAVE_JPEG) #define search_albumart_files rb->search_albumart_files #endif /* This should only be used when loading scaled bitmaps, or using custom output - * plugins. The pluginlib loader does not support loading bitmaps unscaled in - * native format, so rb->read_bmp_file should always be used directly to load - * such images. + * plugins. A native output plugin for the scaler is available as format_native + * on targets with LCD_DEPTH > 1 */ -#if LCD_DEPTH > 1 +#ifdef HAVE_BMP_SCALING #define scaled_read_bmp_file rb->read_bmp_file #define scaled_read_bmp_fd rb->read_bmp_fd -#define read_jpeg_file rb->read_jpeg_file -#define read_jpeg_fd rb->read_jpeg_fd #else #define scaled_read_bmp_file read_bmp_file #define scaled_read_bmp_fd read_bmp_fd #endif +#ifdef HAVE_JPEG +#define read_jpeg_file rb->read_jpeg_file +#define read_jpeg_fd rb->read_jpeg_fd +#else +#endif + #endif diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c index b9cfc4d..495ae49 100644 @@ -122,10 +122,16 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst) } } -#else /* LCD_DEPTH == 1 */ +#endif /* LCD_DEPTH > 1 */ + +#ifndef HAVE_BMP_SCALING #include "wrappers.h" /* import the core bmp loader */ #include "../../recorder/bmp.c" - +#else +/* the full 16x16 Bayer dither matrix may be calculated quickly with this table +*/ +const unsigned char dither_table[16] = + { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 }; #endif diff --git a/apps/plugins/lib/read_image.c b/apps/plugins/lib/read_image.c index 0420ed8..713ad1a 100644 int read_image_file(const char* filename, struct bitmap *bm, int maxsize, int format, const struct custom_format *cformat) { -#if LCD_DEPTH > 1 int namelen = rb->strlen(filename); if (rb->strcmp(filename + namelen - 4, ".bmp")) return read_jpeg_file(filename, bm, maxsize, format, cformat); else -#endif return scaled_read_bmp_file(filename, bm, maxsize, format, cformat); } @@ -45,11 +43,9 @@ int read_image_file_offset(int offset, const char* filename, struct bitmap *bm, return fd; if (offset != rb->lseek(fd, offset, SEEK_SET)) return -1; -#if LCD_DEPTH > 1 int namelen = rb->strlen(filename); if (rb->strcmp(filename + namelen - 4, ".bmp")) return read_jpeg_fd(fd, bm, maxsize, format, cformat); else -#endif return scaled_read_bmp_fd(fd, bm, maxsize, format, cformat); } diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index 3adedc8..24b01f9 100644 @@ -91,7 +91,7 @@ static void fix_path_part(char* path, int offset, int count) } } -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) const char * extensions[] = { "jpeg", "jpg", "bmp" }; int extension_lens[] = { 4, 3, 3 }; /* Try checking for several file extensions, return true if a file is found and @@ -134,7 +134,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, const char *artist; int dirlen; int albumlen; -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) int pathlen; #endif @@ -153,7 +153,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, /* the first file we look for is one specific to the track playing */ strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname); strcat(path, size_string); -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) strcat(path, "."); pathlen = strlen(path); found = try_exts(path, pathlen); @@ -165,7 +165,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, { /* if it doesn't exist, * we look for a file specific to the track's album name */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) pathlen = snprintf(path, sizeof(path), "%s%s%s.", dir, id3->album, size_string); fix_path_part(path, dirlen, albumlen); @@ -181,7 +181,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, if (!found) { /* if it still doesn't exist, we look for a generic file */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) pathlen = snprintf(path, sizeof(path), "%scover%s.", dir, size_string); found = try_exts(path, pathlen); @@ -192,7 +192,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, #endif } -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) if (!found) { snprintf (path, sizeof(path), "%sfolder.jpg", dir); @@ -205,7 +205,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, if (!found && artist && id3->album) { /* look in the albumart subdir of .rockbox */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) pathlen = snprintf(path, sizeof(path), ROCKBOX_DIR "/albumart/%s-%s%s.", artist, @@ -241,7 +241,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, { /* we look in the parent directory * for a file specific to the track's album name */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) pathlen = snprintf(path, sizeof(path), "%s%s%s.", dir, id3->album, size_string); fix_path_part(path, dirlen, albumlen); @@ -258,7 +258,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, { /* if it still doesn't exist, we look in the parent directory * for a generic file */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || defined(PLUGIN) pathlen = snprintf(path, sizeof(path), "%scover%s.", dir, size_string); found = try_exts(path, pathlen); @@ -278,7 +278,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, return true; } -#ifdef HAVE_ALBUMART +#ifndef PLUGIN /* Look for albumart bitmap in the same dir as the track and in its parent dir. * Stores the found filename in the buf parameter. * Returns true if a bitmap was found, false otherwise */ @@ -386,4 +386,4 @@ void get_albumart_size(struct bitmap *bmp) bmp->width = data->albumart_max_width; bmp->height = data->albumart_max_height; } -#endif /* HAVE_ALBUMART */ +#endif /* PLUGIN */ diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c index 3fb8a4d..aeb3202 100644 - skip_lines_bmp and store_part_bmp implement the scaler callbacks to skip ahead by whole lines, or read the next chunk of the current line */ - +#define ROCKBOX_DEBUG_BMP_LOADER #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -184,8 +184,8 @@ struct bmp_args { short depth; unsigned char buf[BM_MAX_WIDTH * 4]; struct uint8_rgb *palette; -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) int cur_row; int cur_col; struct img_part part; @@ -198,8 +198,8 @@ static unsigned int read_part_line(struct bmp_args *ba) const int read_width = ba->read_width; const int width = ba->width; const int depth = ba->depth; -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) int cur_row = ba->cur_row; int cur_col = ba->cur_col; #endif @@ -211,8 +211,8 @@ static unsigned int read_part_line(struct bmp_args *ba) int ret; int i, cols, len; -#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) cols = MIN(width - cur_col,(int)BM_MAX_WIDTH); BDEBUGF("reading %d cols (width: %d, max: %d)\n",cols,width,BM_MAX_WIDTH); len = (cols * (depth == 15 ? 16 : depth) + 7) >> 3; @@ -227,8 +227,8 @@ static unsigned int read_part_line(struct bmp_args *ba) { DEBUGF("read_part_line: error reading image, read returned %d " "expected %d\n", ret, len); -#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) BDEBUGF("cur_row: %d cur_col: %d cols: %d len: %d\n", cur_row, cur_col, cols, len); #endif @@ -290,17 +290,17 @@ static unsigned int read_part_line(struct bmp_args *ba) } } -#if (!defined(HAVE_LCD_COLOR) && \ - (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1))) || \ - defined(PLUGIN) +#if !defined(HAVE_LCD_COLOR) && \ + ((LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ + defined(PLUGIN)) ibuf = ba->buf; buf = (struct uint8_rgb*)ba->buf; while (ibuf < ba->buf + cols) *ibuf++ = brightness(*buf++); #endif -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) cur_col += cols; if (cur_col == width) { @@ -311,8 +311,8 @@ static unsigned int read_part_line(struct bmp_args *ba) BDEBUGF("seeking %d bytes to next line\n",pad); lseek(fd, pad, SEEK_CUR); } -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) cur_col = 0; BDEBUGF("read_part_line: completed row %d\n", cur_row); cur_row += 1; @@ -324,8 +324,8 @@ static unsigned int read_part_line(struct bmp_args *ba) return cols; } -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) static struct img_part *store_part_bmp(void *args) { struct bmp_args *ba = (struct bmp_args *)args; @@ -375,10 +375,13 @@ int read_bmp_fd(int fd, struct uint8_rgb palette[256]; struct rowset rset; struct dim src_dim; -#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) \ - || defined(PLUGIN) - unsigned int resize = IMG_NORESIZE; +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ + defined(PLUGIN) bool dither = false; +#endif +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) + unsigned int resize = IMG_NORESIZE; bool transparent = false; #ifdef HAVE_REMOTE_LCD @@ -398,14 +401,16 @@ int read_bmp_fd(int fd, if (format & FORMAT_TRANSPARENT) { transparent = true; } - if (format & FORMAT_DITHER) { - dither = true; - } #else (void)format; #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ - +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ + defined(PLUGIN) + if (format & FORMAT_DITHER) { + dither = true; + } +#endif /* read fileheader */ ret = read(fd, &bmph, sizeof(struct bmp_header)); if (ret < 0) { @@ -444,8 +449,11 @@ int read_bmp_fd(int fd, bm->format = format & 1; if ((format & 1) == FORMAT_MONO) { +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) resize &= ~IMG_RESIZE; resize |= IMG_NORESIZE; +#endif #ifdef HAVE_REMOTE_LCD remote = 0; #endif @@ -455,8 +463,8 @@ int read_bmp_fd(int fd, return -6; #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) if (resize & IMG_RESIZE) { if(format & FORMAT_KEEP_ASPECT) { /* keep aspect ratio.. */ @@ -471,19 +479,19 @@ int read_bmp_fd(int fd, } } - format &= 1; - if (!(resize & IMG_RESIZE)) { #endif /* returning image size */ bm->width = src_dim.width; bm->height = src_dim.height; -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) } #endif - +#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) + format &= 1; +#endif if (rset.rowstep > 0) { /* Top-down BMP file */ rset.rowstart = 0; rset.rowstop = bm->height; @@ -581,15 +589,15 @@ int read_bmp_fd(int fd, struct bmp_args ba = { .fd = fd, .padded_width = padded_width, .read_width = read_width, .width = src_dim.width, .depth = depth, .palette = palette, -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) .cur_row = 0, .cur_col = 0, .part = {0,0} #endif }; -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) -#if LCD_DEPTH > 1 +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) +#if LCD_DEPTH > 1 && defined(HAVE_BMP_SCALING) if (resize || cformat) #endif { @@ -600,12 +608,12 @@ int read_bmp_fd(int fd, else return 0; } -#ifndef PLUGIN - int fb_width = BM_WIDTH(bm->width,bm->format,remote); -#endif #endif /* LCD_DEPTH */ #ifndef PLUGIN +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) + int fb_width = BM_WIDTH(bm->width,bm->format,remote); +#endif int col, row; /* loop to read rows and put them to buffer */ @@ -706,6 +714,7 @@ int read_bmp_fd(int fd, #endif /* LCD_PIXELFORMAT */ #elif LCD_DEPTH == 16 /* iriver h300, colour iPods, X5 */ +DEBUGF("output row %d\n",row); fb_data *dest = (fb_data *)bitmap + fb_width * row; int delta = 127; unsigned r, g, b; diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c index 79be598..7000c44 100644 @@ -516,8 +516,9 @@ static inline bool scale_v_linear(struct rowset *rset, } #endif /* HAVE_UPSCALER */ -#ifndef PLUGIN -static void output_row_native(uint32_t row, void * row_in, struct scaler_context *ctx) +#if !defined(PLUGIN) || LCD_DEPTH > 1 +void output_row_native(uint32_t row, void * row_in, + struct scaler_context *ctx) { int col; int fb_width = BM_WIDTH(ctx->bm->width,FORMAT_NATIVE,0); @@ -606,6 +607,18 @@ static void output_row_native(uint32_t row, void * row_in, struct scaler_context } #endif +#if defined(PLUGIN) && LCD_DEPTH > 1 +unsigned int get_size_native(struct bitmap *bm) +{ + return BM_SIZE(bm->width,bm->height,FORMAT_NATIVE,FALSE); +} + +const struct custom_format format_native = { + .output_row = output_row_native, + .get_size = get_size_native +}; +#endif + int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, struct rowset *rset, unsigned char *buf, unsigned int len, const struct custom_format *format, @@ -669,7 +682,7 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, ctx.bm = bm; ctx.src = src; ctx.dither = dither; -#ifndef PLUGIN +#if !defined(PLUGIN) ctx.output_row = output_row_native; if (format) #endif diff --git a/apps/recorder/resize.h b/apps/recorder/resize.h index dc93585..5a28ce9 100644 @@ -149,6 +149,12 @@ struct custom_format { }; struct rowset; + +void output_row_native(uint32_t row, void * row_in, + struct scaler_context *ctx); + +extern const struct custom_format format_native; + int recalc_dimension(struct dim *dst, struct dim *src); int resize_on_load(struct bitmap *bm, bool dither, diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h index ed16fb0..5c2b37d 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-c200v2.h b/firmware/export/config-c200v2.h index 1e58573..b47ba73 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h index 85e46f9..bef4bf4 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index fd481d9..59ac564 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-e200v2.h b/firmware/export/config-e200v2.h index dbd3b0c..9ee8572 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-fuze.h b/firmware/export/config-fuze.h index 4cef71e..4f94358 100644 #ifndef BOOTLOADER/* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h index 17ee393..d122edb 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 72b8c3d..a6ec25d 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index 011c131..04a6123 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 1a3c75e..e860538 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index ef53e02..806ce0c 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index bb8e1f7..b772a36 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index e6e07e0..91f54f5 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-hdd1630.h b/firmware/export/config-hdd1630.h index 9b33f6a..d588b3b 100755 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-iaudio7.h b/firmware/export/config-iaudio7.h index 601ff54..8886b18 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-iaudiom3.h b/firmware/export/config-iaudiom3.h index a09be04..5eb7fb8 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h index d186895..0df8414 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 218e165..e048ebe 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h index b4acd38..e642dfd 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 5777375..c13070a 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 7cbe214..599c4c2 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index adb0f0b..11edc98 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 76c81bd..d4fdc2e 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 3f37ce9..c6a0cfa 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 7947997..bd6228b 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index e115f2d..bd93f8f 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-lyre_proto1.h b/firmware/export/config-lyre_proto1.h index 58a9350..d157f5b 100644 #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + #define CONFIG_KEYPAD LYRE_PROTO1_PAD /* Define this if you do software codec */ diff --git a/firmware/export/config-meizu-m3.h b/firmware/export/config-meizu-m3.h index 74fe9fd..2ad2055 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ //#define HAVE_LCD_INVERT diff --git a/firmware/export/config-meizu-m6sl.h b/firmware/export/config-meizu-m6sl.h index b7b50c6..a8e3871 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ //#define HAVE_LCD_INVERT diff --git a/firmware/export/config-meizu-m6sp.h b/firmware/export/config-meizu-m6sp.h index 993c535..2325b47 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ //#define HAVE_LCD_INVERT diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h index 78802e3..e5175fb 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-ondavx747.h b/firmware/export/config-ondavx747.h index e47a8c1..176a35f 100644 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h index cbe92bb..e35c27e 100755 /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT |