summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-05-17 00:45:41 +0000
committerJens Arnold <amiconn@rockbox.org>2004-05-17 00:45:41 +0000
commite3a3a55ab00979be080968f9a4e625cf0f94928f (patch)
treec86939eee860154cb0aca648a31e365fe51d0670 /apps/plugins
parent507800a3865137c86723e8cb65146c6e1b7fce27 (diff)
downloadrockbox-e3a3a55ab00979be080968f9a4e625cf0f94928f.tar.gz
rockbox-e3a3a55ab00979be080968f9a4e625cf0f94928f.zip
Included newest grayscale framework
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4629 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/jpeg.c253
1 files changed, 163 insertions, 90 deletions
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c
index 8f872bdab6..32eedd5d0d 100644
--- a/apps/plugins/jpeg.c
+++ b/apps/plugins/jpeg.c
@@ -315,10 +315,9 @@ void grayblock(int x, int by, unsigned char* src, int stride)
315 315
316 "mov %2,r5 \n" 316 "mov %2,r5 \n"
317 "sub r1,r5 \n" /* r5 = depth - r1 */ 317 "sub r1,r5 \n" /* r5 = depth - r1 */
318 "mov.l .lshrsi3,r1 \n"
319 "jsr @r1 \n" /* shift r4 right by r5 */
318 "mov r0,r1 \n" /* last result stored in r1 */ 320 "mov r0,r1 \n" /* last result stored in r1 */
319 "mov.l .lshrsi3,r0 \n"
320 "jsr @r0 \n" /* shift r4 right by r5 */
321 "nop \n"
322 321
323 "or r1,r0 \n" /* rotated_pattern = r0 | r1 */ 322 "or r1,r0 \n" /* rotated_pattern = r0 | r1 */
324 "mov.l r0,@-r15 \n" /* push pattern */ 323 "mov.l r0,@-r15 \n" /* push pattern */
@@ -641,8 +640,8 @@ void gray_scroll_left(int count, bool black_border);
641void gray_scroll_right(int count, bool black_border); 640void gray_scroll_right(int count, bool black_border);
642void gray_scroll_up8(bool black_border); 641void gray_scroll_up8(bool black_border);
643void gray_scroll_down8(bool black_border); 642void gray_scroll_down8(bool black_border);
644void gray_scroll_up1(bool black_border); 643void gray_scroll_up(int count, bool black_border);
645void gray_scroll_down1(bool black_border); 644void gray_scroll_down(int count, bool black_border);
646 645
647/* pixel functions */ 646/* pixel functions */
648void gray_drawpixel(int x, int y, int brightness); 647void gray_drawpixel(int x, int y, int brightness);
@@ -686,7 +685,7 @@ void gray_black_display(void)
686 rb->memset(graybuf->data, 0xFF, MULU16(graybuf->depth, graybuf->plane_size)); 685 rb->memset(graybuf->data, 0xFF, MULU16(graybuf->depth, graybuf->plane_size));
687} 686}
688 687
689/* Do a lcd_update() to show changes done by rb->lcd_xxx() functions (in areas 688/* Do an lcd_update() to show changes done by rb->lcd_xxx() functions (in areas
690 * of the screen not covered by the grayscale overlay). If the grayscale 689 * of the screen not covered by the grayscale overlay). If the grayscale
691 * overlay is running, the update will be done in the next call of the 690 * overlay is running, the update will be done in the next call of the
692 * interrupt routine, otherwise it will be performed right away. See also 691 * interrupt routine, otherwise it will be performed right away. See also
@@ -704,6 +703,9 @@ void gray_deferred_update(void)
704 * 703 *
705 * black_border determines if the pixels scrolled in at the right are black 704 * black_border determines if the pixels scrolled in at the right are black
706 * or white 705 * or white
706 *
707 * Scrolling left/right by an even pixel count is almost twice as fast as
708 * scrolling by an odd pixel count.
707 */ 709 */
708void gray_scroll_left(int count, bool black_border) 710void gray_scroll_left(int count, bool black_border)
709{ 711{
@@ -766,6 +768,9 @@ void gray_scroll_left(int count, bool black_border)
766 * 768 *
767 * black_border determines if the pixels scrolled in at the left are black 769 * black_border determines if the pixels scrolled in at the left are black
768 * or white 770 * or white
771 *
772 * Scrolling left/right by an even pixel count is almost twice as fast as
773 * scrolling by an odd pixel count.
769 */ 774 */
770void gray_scroll_right(int count, bool black_border) 775void gray_scroll_right(int count, bool black_border)
771{ 776{
@@ -792,7 +797,7 @@ void gray_scroll_right(int count, bool black_border)
792 ".sr_loop1: \n" 797 ".sr_loop1: \n"
793 "mov.b @(%2,%0),r1 \n" 798 "mov.b @(%2,%0),r1 \n"
794 "mov.b r1,@-%0 \n" 799 "mov.b r1,@-%0 \n"
795 "cmp/hs %1,%0 \n" 800 "cmp/hi %1,%0 \n"
796 "bt .sr_loop1 \n" 801 "bt .sr_loop1 \n"
797 : /* outputs */ 802 : /* outputs */
798 : /* inputs */ 803 : /* inputs */
@@ -807,7 +812,7 @@ void gray_scroll_right(int count, bool black_border)
807 ".sr_loop2: \n" 812 ".sr_loop2: \n"
808 "mov.w @(%2,%0),r1 \n" 813 "mov.w @(%2,%0),r1 \n"
809 "mov.w r1,@-%0 \n" 814 "mov.w r1,@-%0 \n"
810 "cmp/hs %1,%0 \n" 815 "cmp/hi %1,%0 \n"
811 "bt .sr_loop2 \n" 816 "bt .sr_loop2 \n"
812 : /* outputs */ 817 : /* outputs */
813 : /* inputs */ 818 : /* inputs */
@@ -828,6 +833,8 @@ void gray_scroll_right(int count, bool black_border)
828 * 833 *
829 * black_border determines if the pixels scrolled in at the bottom are black 834 * black_border determines if the pixels scrolled in at the bottom are black
830 * or white 835 * or white
836 *
837 * Scrolling up/down by 8 pixels is very fast.
831 */ 838 */
832void gray_scroll_up8(bool black_border) 839void gray_scroll_up8(bool black_border)
833{ 840{
@@ -866,6 +873,8 @@ void gray_scroll_up8(bool black_border)
866 * 873 *
867 * black_border determines if the pixels scrolled in at the top are black 874 * black_border determines if the pixels scrolled in at the top are black
868 * or white 875 * or white
876 *
877 * Scrolling up/down by 8 pixels is very fast.
869 */ 878 */
870void gray_scroll_down8(bool black_border) 879void gray_scroll_down8(bool black_border)
871{ 880{
@@ -900,7 +909,7 @@ void gray_scroll_down8(bool black_border)
900 } 909 }
901} 910}
902 911
903/* Scroll the whole grayscale buffer up by 1 pixel 912/* Scroll the whole grayscale buffer up by <count> pixels (<= 7)
904 * 913 *
905 * black_border determines if the pixels scrolled in at the bottom are black 914 * black_border determines if the pixels scrolled in at the bottom are black
906 * or white 915 * or white
@@ -909,51 +918,84 @@ void gray_scroll_down8(bool black_border)
909 * left/right or scrolling up/down byte-wise because it involves bit 918 * left/right or scrolling up/down byte-wise because it involves bit
910 * shifting. That's why it is asm optimized. 919 * shifting. That's why it is asm optimized.
911 */ 920 */
912void gray_scroll_up1(bool black_border) 921void gray_scroll_up(int count, bool black_border)
913{ 922{
914 int filler; 923 unsigned long filler;
915 924
916 if (graybuf == NULL) 925 if (graybuf == NULL || (unsigned) count > 7)
917 return; 926 return;
918 927
919 if (black_border) 928 if (black_border)
920 filler = 1; 929 filler = 0xFF;
921 else 930 else
922 filler = 0; 931 filler = 0;
923 932
924 /* scroll column by column to minimize flicker */ 933 /* scroll column by column to minimize flicker */
925 asm( 934 asm(
926 "mov #0,r6 \n" /* x = 0; */ 935 "mov #0,r6 \n" /* x = 0 */
936 "mova .su_shifttbl,r0 \n" /* calculate jump destination for */
937 "mov.b @(r0,%6),%6 \n" /* shift amount from table */
938 "bra .su_cloop \n" /* skip table */
939 "add r0,%6 \n"
940
941 ".align 2 \n"
942 ".su_shifttbl: \n" /* shift jump offset table */
943 ".byte .su_shift0 - .su_shifttbl \n"
944 ".byte .su_shift1 - .su_shifttbl \n"
945 ".byte .su_shift2 - .su_shifttbl \n"
946 ".byte .su_shift3 - .su_shifttbl \n"
947 ".byte .su_shift4 - .su_shifttbl \n"
948 ".byte .su_shift5 - .su_shifttbl \n"
949 ".byte .su_shift6 - .su_shifttbl \n"
950 ".byte .su_shift7 - .su_shifttbl \n"
927 951
928 ".su_cloop: \n" /* repeat for every column */ 952 ".su_cloop: \n" /* repeat for every column */
929 "mov %1,r7 \n" /* get start address */ 953 "mov %1,r2 \n" /* get start address */
930 "mov #0,r1 \n" /* current_plane = 0 */ 954 "mov #0,r3 \n" /* current_plane = 0 */
931 955
932 ".su_oloop: \n" /* repeat for every bitplane */ 956 ".su_oloop: \n" /* repeat for every bitplane */
933 "mov r7,r2 \n" /* get start address */ 957 "mov r2,r4 \n" /* get start address */
934 "mov #0,r3 \n" /* current_row = 0 */ 958 "mov #0,r5 \n" /* current_row = 0 */
935 "mov %5,r5 \n" /* get filler bit (bit 0) */ 959 "mov %5,r1 \n" /* get filler bits */
936 960
937 ".su_iloop: \n" /* repeat for all rows */ 961 ".su_iloop: \n" /* repeat for all rows */
938 "sub %2,r2 \n" /* address -= width; */ 962 "sub %2,r4 \n" /* address -= width */
939 "mov.b @r2,r4 \n" /* get new byte */ 963 "mov.b @r4,r0 \n" /* get data byte */
940 "shll8 r5 \n" /* shift old lsb to bit 8 */ 964 "shll8 r1 \n" /* old data to 2nd byte */
941 "extu.b r4,r4 \n" /* extend byte unsigned */ 965 "extu.b r0,r0 \n" /* extend unsigned */
942 "or r5,r4 \n" /* merge old lsb */ 966 "or r1,r0 \n" /* combine old data */
943 "shlr r4 \n" /* shift right */ 967 "jmp @%6 \n" /* jump into shift "path" */
944 "movt r5 \n" /* save new lsb */ 968 "extu.b r0,r1 \n" /* store data for next round */
945 "mov.b r4,@r2 \n" /* store byte */ 969
946 "add #1,r3 \n" /* current_row++; */ 970 ".su_shift6: \n" /* shift right by 0..7 bits */
947 "cmp/hi r3,%3 \n" /* cuurent_row < bheight ? */ 971 "shlr2 r0 \n"
972 ".su_shift4: \n"
973 "shlr2 r0 \n"
974 ".su_shift2: \n"
975 "bra .su_shift0 \n"
976 "shlr2 r0 \n"
977 ".su_shift7: \n"
978 "shlr2 r0 \n"
979 ".su_shift5: \n"
980 "shlr2 r0 \n"
981 ".su_shift3: \n"
982 "shlr2 r0 \n"
983 ".su_shift1: \n"
984 "shlr r0 \n"
985 ".su_shift0: \n"
986
987 "mov.b r0,@r4 \n" /* store data */
988 "add #1,r5 \n" /* current_row++ */
989 "cmp/hi r5,%3 \n" /* current_row < bheight ? */
948 "bt .su_iloop \n" 990 "bt .su_iloop \n"
949 991
950 "add %4,r7 \n" /* start_address += plane_size; */ 992 "add %4,r2 \n" /* start_address += plane_size */
951 "add #1,r1 \n" /* current_plane++; */ 993 "add #1,r3 \n" /* current_plane++ */
952 "cmp/hi r1,%0 \n" /* current_plane < depth ? */ 994 "cmp/hi r3,%0 \n" /* current_plane < depth ? */
953 "bt .su_oloop \n" 995 "bt .su_oloop \n"
954 996
955 "add #1,%1 \n" /* start_address++; */ 997 "add #1,%1 \n" /* start_address++ */
956 "add #1,r6 \n" /* x++; */ 998 "add #1,r6 \n" /* x++ */
957 "cmp/hi r6,%2 \n" /* x < width ? */ 999 "cmp/hi r6,%2 \n" /* x < width ? */
958 "bt .su_cloop \n" 1000 "bt .su_cloop \n"
959 : /* outputs */ 1001 : /* outputs */
@@ -963,67 +1005,100 @@ void gray_scroll_up1(bool black_border)
963 /* %2 */ "r"(graybuf->width), 1005 /* %2 */ "r"(graybuf->width),
964 /* %3 */ "r"(graybuf->bheight), 1006 /* %3 */ "r"(graybuf->bheight),
965 /* %4 */ "r"(graybuf->plane_size), 1007 /* %4 */ "r"(graybuf->plane_size),
966 /* %5 */ "r"(filler) 1008 /* %5 */ "r"(filler),
1009 /* %6 */ "r"(count)
967 : /* clobbers */ 1010 : /* clobbers */
968 "r1", "r2", "r3", "r4", "r5", "r6", "r7" 1011 "r0", "r1", "r2", "r3", "r4", "r5", "r6"
969 ); 1012 );
970} 1013}
971 1014
972/* Scroll the whole grayscale buffer down by 1 pixel 1015/* Scroll the whole grayscale buffer down by <count> pixels (<= 7)
973 * 1016 *
974 * black_border determines if the pixels scrolled in at the top are black 1017 * black_border determines if the pixels scrolled in at the top are black
975 * or white 1018 * or white
976 * 1019 *
977 * Scrolling up/down pixel-wise is significantly slower than scrolling 1020 * Scrolling up/down pixel-wise is significantly slower than scrolling
978 * left/right or scrolling up/down byte-wise because it involves bit 1021 * left/right or scrolling up/down byte-wise because it involves bit
979 * shifting. That's why it is asm optimized. Scrolling down is a bit 1022 * shifting. That's why it is asm optimized.
980 * faster than scrolling up, though.
981 */ 1023 */
982void gray_scroll_down1(bool black_border) 1024void gray_scroll_down(int count, bool black_border)
983{ 1025{
984 int filler; 1026 unsigned long filler;
985 1027
986 if (graybuf == NULL) 1028 if (graybuf == NULL || (unsigned) count > 7)
987 return; 1029 return;
988 1030
989 if (black_border) 1031 if (black_border)
990 filler = -1; /* sets bit 31 */ 1032 filler = 0xFF << count; /* calculate filler bits */
991 else 1033 else
992 filler = 0; 1034 filler = 0;
993 1035
994 /* scroll column by column to minimize flicker */ 1036 /* scroll column by column to minimize flicker */
995 asm( 1037 asm(
996 "mov #0,r5 \n" /* x = 0; */ 1038 "mov #0,r6 \n" /* x = 0 */
1039 "mova .sd_shifttbl,r0 \n" /* calculate jump destination for */
1040 "mov.b @(r0,%6),%6 \n" /* shift amount from table */
1041 "bra .sd_cloop \n" /* skip table */
1042 "add r0,%6 \n"
1043
1044 ".align 2 \n"
1045 ".sd_shifttbl: \n" /* shift jump offset table */
1046 ".byte .sd_shift0 - .sd_shifttbl \n"
1047 ".byte .sd_shift1 - .sd_shifttbl \n"
1048 ".byte .sd_shift2 - .sd_shifttbl \n"
1049 ".byte .sd_shift3 - .sd_shifttbl \n"
1050 ".byte .sd_shift4 - .sd_shifttbl \n"
1051 ".byte .sd_shift5 - .sd_shifttbl \n"
1052 ".byte .sd_shift6 - .sd_shifttbl \n"
1053 ".byte .sd_shift7 - .sd_shifttbl \n"
997 1054
998 ".sd_cloop: \n" /* repeat for every column */ 1055 ".sd_cloop: \n" /* repeat for every column */
999 "mov %1,r6 \n" /* get start address */ 1056 "mov %1,r2 \n" /* get start address */
1000 "mov #0,r1 \n" /* current_plane = 0 */ 1057 "mov #0,r3 \n" /* current_plane = 0 */
1001 1058
1002 ".sd_oloop: \n" /* repeat for every bitplane */ 1059 ".sd_oloop: \n" /* repeat for every bitplane */
1003 "mov r6,r2 \n" /* get start address */ 1060 "mov r2,r4 \n" /* get start address */
1004 "mov #0,r3 \n" /* current_row = 0 */ 1061 "mov #0,r5 \n" /* current_row = 0 */
1005 "mov %5,r4 \n" /* get filler bit (bit 31) */ 1062 "mov %5,r1 \n" /* get filler bits */
1006 1063
1007 ".sd_iloop: \n" /* repeat for all rows */ 1064 ".sd_iloop: \n" /* repeat for all rows */
1008 "shll r4 \n" /* get old msb (again) */ 1065 "shlr8 r1 \n" /* shift right to get residue */
1009 /* This is possible because the sh1 loads byte data sign-extended, 1066 "mov.b @r4,r0 \n" /* get data byte */
1010 * so the upper 25 bits of the register are all identical */ 1067 "jmp @%6 \n" /* jump into shift "path" */
1011 "mov.b @r2,r4 \n" /* get new byte */ 1068 "extu.b r0,r0 \n" /* extend unsigned */
1012 "add #1,r3 \n" /* current_row++; */ 1069
1013 "rotcl r4 \n" /* rotate left, merges previous msb */ 1070 ".sd_shift6: \n" /* shift left by 0..7 bits */
1014 "mov.b r4,@r2 \n" /* store byte */ 1071 "shll2 r0 \n"
1015 "add %2,r2 \n" /* address += width; */ 1072 ".sd_shift4: \n"
1016 "cmp/hi r3,%3 \n" /* cuurent_row < bheight ? */ 1073 "shll2 r0 \n"
1074 ".sd_shift2: \n"
1075 "bra .sd_shift0 \n"
1076 "shll2 r0 \n"
1077 ".sd_shift7: \n"
1078 "shll2 r0 \n"
1079 ".sd_shift5: \n"
1080 "shll2 r0 \n"
1081 ".sd_shift3: \n"
1082 "shll2 r0 \n"
1083 ".sd_shift1: \n"
1084 "shll r0 \n"
1085 ".sd_shift0: \n"
1086
1087 "or r0,r1 \n" /* combine with last residue */
1088 "mov.b r1,@r4 \n" /* store data */
1089 "add %2,r4 \n" /* address += width */
1090 "add #1,r5 \n" /* current_row++ */
1091 "cmp/hi r5,%3 \n" /* current_row < bheight ? */
1017 "bt .sd_iloop \n" 1092 "bt .sd_iloop \n"
1018 1093
1019 "add %4,r6 \n" /* start_address += plane_size; */ 1094 "add %4,r2 \n" /* start_address += plane_size */
1020 "add #1,r1 \n" /* current_plane++; */ 1095 "add #1,r3 \n" /* current_plane++ */
1021 "cmp/hi r1,%0 \n" /* current_plane < depth ? */ 1096 "cmp/hi r3,%0 \n" /* current_plane < depth ? */
1022 "bt .sd_oloop \n" 1097 "bt .sd_oloop \n"
1023 1098
1024 "add #1,%1 \n" /* start_address++; */ 1099 "add #1,%1 \n" /* start_address++ */
1025 "add #1,r5 \n" /* x++ */ 1100 "add #1,r6 \n" /* x++ */
1026 "cmp/hi r5,%2 \n" /* x < width ? */ 1101 "cmp/hi r6,%2 \n" /* x < width ? */
1027 "bt .sd_cloop \n" 1102 "bt .sd_cloop \n"
1028 : /* outputs */ 1103 : /* outputs */
1029 : /* inputs */ 1104 : /* inputs */
@@ -1032,9 +1107,10 @@ void gray_scroll_down1(bool black_border)
1032 /* %2 */ "r"(graybuf->width), 1107 /* %2 */ "r"(graybuf->width),
1033 /* %3 */ "r"(graybuf->bheight), 1108 /* %3 */ "r"(graybuf->bheight),
1034 /* %4 */ "r"(graybuf->plane_size), 1109 /* %4 */ "r"(graybuf->plane_size),
1035 /* %5 */ "r"(filler) 1110 /* %5 */ "r"(filler),
1111 /* %6 */ "r"(count)
1036 : /* clobbers */ 1112 : /* clobbers */
1037 "r1", "r2", "r3", "r4", "r5", "r6" 1113 "r0", "r1", "r2", "r3", "r4", "r5", "r6"
1038 ); 1114 );
1039} 1115}
1040 1116
@@ -1438,7 +1514,7 @@ void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny,
1438 1514
1439 for (yi = y; yi < y + ny; ) 1515 for (yi = y; yi < y + ny; )
1440 { 1516 {
1441 row = src; 1517 row = src;
1442 1518
1443 if (!(yi & 7) && (y + ny - yi > 7)) 1519 if (!(yi & 7) && (y + ny - yi > 7))
1444 /* current row byte aligned in fb & at least 8 rows left */ 1520 /* current row byte aligned in fb & at least 8 rows left */
@@ -1449,7 +1525,7 @@ void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny,
1449 grayblock(xi, yi >> 3, row++, stride); 1525 grayblock(xi, yi >> 3, row++, stride);
1450 } 1526 }
1451 yi += 8; 1527 yi += 8;
1452 src += stride << 3; 1528 src += stride << 3;
1453 } 1529 }
1454 else 1530 else
1455 { 1531 {
@@ -1459,7 +1535,7 @@ void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny,
1459 graybuf->depth + 1) >> 8]); 1535 graybuf->depth + 1) >> 8]);
1460 } 1536 }
1461 yi++; 1537 yi++;
1462 src += stride; 1538 src += stride;
1463 } 1539 }
1464 } 1540 }
1465} 1541}
@@ -2963,9 +3039,8 @@ int scroll_bmp(struct t_disp* pdisp)
2963 { 3039 {
2964 int button; 3040 int button;
2965 int move; 3041 int move;
2966 int i;
2967 3042
2968 /* we're unfortunately slower than key repeat, 3043 /* we're unfortunately slower than key repeat,
2969 so empty the button queue, to avoid post-scroll */ 3044 so empty the button queue, to avoid post-scroll */
2970 while(rb->button_get(false) != BUTTON_NONE); 3045 while(rb->button_get(false) != BUTTON_NONE);
2971 3046
@@ -3014,8 +3089,7 @@ int scroll_bmp(struct t_disp* pdisp)
3014 if (move == 8) 3089 if (move == 8)
3015 gray_scroll_down8(false); /* scroll down by 8 pixel */ 3090 gray_scroll_down8(false); /* scroll down by 8 pixel */
3016 else 3091 else
3017 for (i=0; i<move; i++) 3092 gray_scroll_down(move, false); /* scroll down 1..7 pixel */
3018 gray_scroll_down1(false); /* n times one pixel */
3019 pdisp->y -= move; 3093 pdisp->y -= move;
3020 gray_drawgraymap( 3094 gray_drawgraymap(
3021 pdisp->bitmap + pdisp->y * pdisp->stride + pdisp->x, 3095 pdisp->bitmap + pdisp->y * pdisp->stride + pdisp->x,
@@ -3032,8 +3106,7 @@ int scroll_bmp(struct t_disp* pdisp)
3032 if (move == 8) 3106 if (move == 8)
3033 gray_scroll_up8(false); /* scroll up by 8 pixel */ 3107 gray_scroll_up8(false); /* scroll up by 8 pixel */
3034 else 3108 else
3035 for (i=0; i<move; i++) 3109 gray_scroll_up(move, false); /* scroll up 1..7 pixel */
3036 gray_scroll_up1(false); /* n times one pixel */
3037 pdisp->y += move; 3110 pdisp->y += move;
3038 gray_drawgraymap( 3111 gray_drawgraymap(
3039 pdisp->bitmap + (pdisp->y + LCD_HEIGHT - move) * pdisp->stride + pdisp->x, 3112 pdisp->bitmap + (pdisp->y + LCD_HEIGHT - move) * pdisp->stride + pdisp->x,
@@ -3137,7 +3210,7 @@ int main(char* filename)
3137 long time; /* measured ticks */ 3210 long time; /* measured ticks */
3138 3211
3139 static struct jpeg jpg; /* too large for stack */ 3212 static struct jpeg jpg; /* too large for stack */
3140 int status; 3213 int status;
3141 int ds, ds_min, ds_max; /* scaling and limits */ 3214 int ds, ds_min, ds_max; /* scaling and limits */
3142 3215
3143 buf = rb->plugin_get_mp3_buffer(&buf_size); 3216 buf = rb->plugin_get_mp3_buffer(&buf_size);
@@ -3189,17 +3262,17 @@ int main(char* filename)
3189 rb->lcd_puts(0, 1, print); 3262 rb->lcd_puts(0, 1, print);
3190 rb->lcd_update(); 3263 rb->lcd_update();
3191 3264
3192 rb->memset(&jpg, 0, sizeof(jpg)); /* clear info struct */ 3265 rb->memset(&jpg, 0, sizeof(jpg)); /* clear info struct */
3193 /* process markers, unstuffing */ 3266 /* process markers, unstuffing */
3194 status = process_markers(buf_jpeg, filesize, &jpg); 3267 status = process_markers(buf_jpeg, filesize, &jpg);
3195 if (status < 0 || (status & (DQT | SOF0)) != (DQT | SOF0)) 3268 if (status < 0 || (status & (DQT | SOF0)) != (DQT | SOF0))
3196 { /* bad format or minimum components not contained */ 3269 { /* bad format or minimum components not contained */
3197 rb->splash(HZ*2, true, "unsupported %d", status); 3270 rb->splash(HZ*2, true, "unsupported %d", status);
3198 return PLUGIN_ERROR; 3271 return PLUGIN_ERROR;
3199 } 3272 }
3200 if (!(status & DHT)) /* if no Huffman table present: */ 3273 if (!(status & DHT)) /* if no Huffman table present: */
3201 default_huff_tbl(&jpg); /* use default */ 3274 default_huff_tbl(&jpg); /* use default */
3202 build_lut(&jpg); /* derive Huffman and other lookup-tables */ 3275 build_lut(&jpg); /* derive Huffman and other lookup-tables */
3203 3276
3204 /* I can correct the buffer now, re-gain what the removed markers took */ 3277 /* I can correct the buffer now, re-gain what the removed markers took */
3205 buf -= filesize; /* back to before */ 3278 buf -= filesize; /* back to before */