summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-06-18 07:15:00 +0200
committerThomas Martitz <kugel@rockbox.org>2014-06-21 00:15:53 +0200
commita1842c04f9cb73210d4cacde61a9e4b115050765 (patch)
treea37af61ef9285b763a42cd33797e2f3d634fbf9f /apps/plugins/mpegplayer
parent0250be1d6799db7b5ddc99cb33f31bf9cff01ed2 (diff)
downloadrockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.tar.gz
rockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.zip
lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS can display from our 24bit framebuffer. It is not yet as performance optimized as the existing drivers but should be good enough.The vast number of small changes is due to the fact that fb_data can be a struct type now, while most of the code expected a scalar type. lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit it enforces the generic C code. All plugins are ported over. Except for rockpaint. It uses so much memory that it wouldnt fit into the 512k plugin buffer anymore (patches welcome). Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
Diffstat (limited to 'apps/plugins/mpegplayer')
-rw-r--r--apps/plugins/mpegplayer/alloc.c1
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c32
2 files changed, 27 insertions, 6 deletions
diff --git a/apps/plugins/mpegplayer/alloc.c b/apps/plugins/mpegplayer/alloc.c
index eb58c67f44..cbf930a7eb 100644
--- a/apps/plugins/mpegplayer/alloc.c
+++ b/apps/plugins/mpegplayer/alloc.c
@@ -231,4 +231,3 @@ void codec_free(void* ptr)
231#endif 231#endif
232 (void)ptr; 232 (void)ptr;
233} 233}
234
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 2e84a870a9..97fe7d3f4c 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -702,7 +702,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
702 dst_col--; 702 dst_col--;
703 703
704 if (data & 1) 704 if (data & 1)
705 *dst_col = fg_pattern; 705 *dst_col = FB_SCALARPACK(fg_pattern);
706#if 0 706#if 0
707 else 707 else
708 *dst_col = bg_pattern; 708 *dst_col = bg_pattern;
@@ -719,7 +719,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
719 while (src < src_end); 719 while (src < src_end);
720} 720}
721 721
722/* draw alpha bitmap for anti-alias font */ 722
723#define ALPHA_COLOR_FONT_DEPTH 2 723#define ALPHA_COLOR_FONT_DEPTH 2
724#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH) 724#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH)
725#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1) 725#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1)
@@ -727,6 +727,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
727#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH) 727#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH)
728#ifdef CPU_ARM 728#ifdef CPU_ARM
729#define BLEND_INIT do {} while (0) 729#define BLEND_INIT do {} while (0)
730#define BLEND_FINISH do {} while(0)
730#define BLEND_START(acc, color, alpha) \ 731#define BLEND_START(acc, color, alpha) \
731 asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha)) 732 asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha))
732#define BLEND_CONT(acc, color, alpha) \ 733#define BLEND_CONT(acc, color, alpha) \
@@ -734,13 +735,18 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
734#define BLEND_OUT(acc) do {} while (0) 735#define BLEND_OUT(acc) do {} while (0)
735#elif defined(CPU_COLDFIRE) 736#elif defined(CPU_COLDFIRE)
736#define ALPHA_BITMAP_READ_WORDS 737#define ALPHA_BITMAP_READ_WORDS
737#define BLEND_INIT coldfire_set_macsr(EMAC_UNSIGNED) 738#define BLEND_INIT \
739 unsigned long _macsr = coldfire_get_macsr(); \
740 coldfire_set_macsr(EMAC_UNSIGNED)
741#define BLEND_FINISH \
742 coldfire_set_macsr(_macsr)
738#define BLEND_START(acc, color, alpha) \ 743#define BLEND_START(acc, color, alpha) \
739 asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha)) 744 asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha))
740#define BLEND_CONT BLEND_START 745#define BLEND_CONT BLEND_START
741#define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc)) 746#define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc))
742#else 747#else
743#define BLEND_INIT do {} while (0) 748#define BLEND_INIT do {} while (0)
749#define BLEND_FINISH do {} while(0)
744#define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha)) 750#define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha))
745#define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha)) 751#define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha))
746#define BLEND_OUT(acc) do {} while (0) 752#define BLEND_OUT(acc) do {} while (0)
@@ -749,6 +755,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
749/* Blend the given two colors */ 755/* Blend the given two colors */
750static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a) 756static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a)
751{ 757{
758#if LCD_DEPTH == 16
752 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1); 759 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
753#if (LCD_PIXELFORMAT == RGB565SWAPPED) 760#if (LCD_PIXELFORMAT == RGB565SWAPPED)
754 c1 = swap16(c1); 761 c1 = swap16(c1);
@@ -767,6 +774,20 @@ static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a)
767#else 774#else
768 return p; 775 return p;
769#endif 776#endif
777
778#else /* LCD_DEPTH == 24 */
779 unsigned s = c1;
780 unsigned d = c2;
781 unsigned s1 = s & 0xff00ff;
782 unsigned d1 = d & 0xff00ff;
783 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
784 d1 = (d1 + ((s1 - d1) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00ff;
785 s &= 0xff00;
786 d &= 0xff00;
787 d = (d + ((s - d) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00;
788
789 return d1 | d;
790#endif
770} 791}
771 792
772static void draw_oriented_alpha_bitmap_part(const unsigned char *src, 793static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
@@ -849,8 +870,9 @@ static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
849#endif 870#endif
850 do 871 do
851 { 872 {
852 *dst=blend_two_colors(*dst, fg_pattern, 873 unsigned color = blend_two_colors(FB_UNPACK_SCALAR_LCD(*dst), fg_pattern,
853 data & ALPHA_COLOR_LOOKUP_SIZE ); 874 data & ALPHA_COLOR_LOOKUP_SIZE );
875 *dst= FB_SCALARPACK(color);
854 dst += LCD_WIDTH; 876 dst += LCD_WIDTH;
855 UPDATE_SRC_ALPHA; 877 UPDATE_SRC_ALPHA;
856 } 878 }