diff options
author | Dave Chapman <dave@dchapman.com> | 2007-03-26 01:32:31 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2007-03-26 01:32:31 +0000 |
commit | a56757137c9b8e11e5380270a1ebbbd29ad0b0d0 (patch) | |
tree | e2113fd56fd537d95e96a972925a8c05fc40dfe6 | |
parent | 8f04faef91e759aa97d85f403ba236278a25d9f6 (diff) | |
download | rockbox-a56757137c9b8e11e5380270a1ebbbd29ad0b0d0.tar.gz rockbox-a56757137c9b8e11e5380270a1ebbbd29ad0b0d0.zip |
mpegplayer for grayscale targets. Note that performance is slow...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12913 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/SUBDIRS | 5 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/Makefile | 2 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 39 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/video_out_rockbox.c | 6 |
4 files changed, 46 insertions, 6 deletions
diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS index 4a2a819b97..70cffe7e0d 100644 --- a/apps/plugins/SUBDIRS +++ b/apps/plugins/SUBDIRS | |||
@@ -31,10 +31,9 @@ pacbox | |||
31 | doom | 31 | doom |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | /* For all the colour targets */ | 34 | /* For all the swcodec targets */ |
35 | #if defined(HAVE_LCD_COLOR) | 35 | #if CONFIG_CODEC == SWCODEC |
36 | mpegplayer | 36 | mpegplayer |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | |||
40 | #endif /* IRIVER_IFP7XX_SERIES */ | 39 | #endif /* IRIVER_IFP7XX_SERIES */ |
diff --git a/apps/plugins/mpegplayer/Makefile b/apps/plugins/mpegplayer/Makefile index 7b52d2df5e..28691f4b17 100644 --- a/apps/plugins/mpegplayer/Makefile +++ b/apps/plugins/mpegplayer/Makefile | |||
@@ -8,7 +8,7 @@ | |||
8 | # | 8 | # |
9 | 9 | ||
10 | INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ | 10 | INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ |
11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) | 11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(APPSDIR)/plugins/lib -I$(OUTDIR) -I$(BUILDDIR) |
12 | CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \ | 12 | CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \ |
13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN | 13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN |
14 | 14 | ||
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 80159e3be6..a5b71c089a 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -103,6 +103,7 @@ FPS | 27Mhz | 100Hz | 44.1KHz | 48KHz | |||
103 | #include "mpeg2dec_config.h" | 103 | #include "mpeg2dec_config.h" |
104 | 104 | ||
105 | #include "plugin.h" | 105 | #include "plugin.h" |
106 | #include "gray.h" | ||
106 | 107 | ||
107 | #include "mpeg2.h" | 108 | #include "mpeg2.h" |
108 | #include "mpeg_settings.h" | 109 | #include "mpeg_settings.h" |
@@ -270,8 +271,16 @@ static void button_loop(void) | |||
270 | /* Wait for video thread to stop */ | 271 | /* Wait for video thread to stop */ |
271 | while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); } | 272 | while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); } |
272 | } | 273 | } |
274 | |||
275 | #ifndef HAVE_LCD_COLOR | ||
276 | gray_show(false); | ||
277 | #endif | ||
273 | result = mpeg_menu(); | 278 | result = mpeg_menu(); |
274 | 279 | ||
280 | #ifndef HAVE_LCD_COLOR | ||
281 | gray_show(true); | ||
282 | #endif | ||
283 | |||
275 | /* The menu can change the font, so restore */ | 284 | /* The menu can change the font, so restore */ |
276 | rb->lcd_setfont(FONT_SYSFIXED); | 285 | rb->lcd_setfont(FONT_SYSFIXED); |
277 | 286 | ||
@@ -911,6 +920,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
911 | size_t file_remaining; | 920 | size_t file_remaining; |
912 | size_t n; | 921 | size_t n; |
913 | size_t disk_buf_len; | 922 | size_t disk_buf_len; |
923 | #ifndef HAVE_LCD_COLOR | ||
924 | long graysize; | ||
925 | int grayscales; | ||
926 | #endif | ||
914 | 927 | ||
915 | /* We define this here so it is on the main stack (in IRAM) */ | 928 | /* We define this here so it is on the main stack (in IRAM) */ |
916 | mad_fixed_t mad_frame_overlap[2][32][18]; /* 4608 bytes */ | 929 | mad_fixed_t mad_frame_overlap[2][32][18]; /* 4608 bytes */ |
@@ -940,13 +953,27 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
940 | buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE); | 953 | buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE); |
941 | 954 | ||
942 | DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size); | 955 | DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size); |
943 | buffer_size &= ~(0x7ff); /* Round buffer down to nearest 2KB */ | ||
944 | DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size); | ||
945 | buffer = mpeg2_malloc(buffer_size,-1); | 956 | buffer = mpeg2_malloc(buffer_size,-1); |
946 | 957 | ||
947 | if (buffer == NULL) | 958 | if (buffer == NULL) |
948 | return PLUGIN_ERROR; | 959 | return PLUGIN_ERROR; |
949 | 960 | ||
961 | #ifndef HAVE_LCD_COLOR | ||
962 | /* initialize the grayscale buffer: 32 bitplanes for 33 shades of gray. */ | ||
963 | grayscales = gray_init(rb, buffer, buffer_size, false, LCD_WIDTH, LCD_HEIGHT, | ||
964 | 32, 2<<8, &graysize) + 1; | ||
965 | buffer += graysize; | ||
966 | buffer_size -= graysize; | ||
967 | if (grayscales < 33 || buffer_size <= 0) | ||
968 | { | ||
969 | rb->splash(HZ, "gray buf error"); | ||
970 | return PLUGIN_ERROR; | ||
971 | } | ||
972 | #endif | ||
973 | |||
974 | buffer_size &= ~(0x7ff); /* Round buffer down to nearest 2KB */ | ||
975 | DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size); | ||
976 | |||
950 | mpa_buffer_size = AUDIOBUFFER_SIZE; | 977 | mpa_buffer_size = AUDIOBUFFER_SIZE; |
951 | mpa_buffer = mpeg2_malloc(mpa_buffer_size,-2); | 978 | mpa_buffer = mpeg2_malloc(mpa_buffer_size,-2); |
952 | 979 | ||
@@ -1026,6 +1053,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1026 | audiostatus = STREAM_BUFFERING; | 1053 | audiostatus = STREAM_BUFFERING; |
1027 | videostatus = STREAM_PLAYING; | 1054 | videostatus = STREAM_PLAYING; |
1028 | 1055 | ||
1056 | #ifndef HAVE_LCD_COLOR | ||
1057 | gray_show(true); | ||
1058 | #endif | ||
1059 | |||
1029 | /* We put the video thread on the second processor for multi-core targets. */ | 1060 | /* We put the video thread on the second processor for multi-core targets. */ |
1030 | if ((videothread_id = rb->create_thread(video_thread, | 1061 | if ((videothread_id = rb->create_thread(video_thread, |
1031 | (uint8_t*)video_stack,VIDEO_STACKSIZE,"mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) | 1062 | (uint8_t*)video_stack,VIDEO_STACKSIZE,"mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) |
@@ -1074,6 +1105,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1074 | rb->sleep(HZ/10); | 1105 | rb->sleep(HZ/10); |
1075 | } | 1106 | } |
1076 | 1107 | ||
1108 | #ifndef HAVE_LCD_COLOR | ||
1109 | gray_release(); | ||
1110 | #endif | ||
1111 | |||
1077 | rb->remove_thread(audiothread_id); | 1112 | rb->remove_thread(audiothread_id); |
1078 | rb->yield(); /* Is this needed? */ | 1113 | rb->yield(); /* Is this needed? */ |
1079 | 1114 | ||
diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c index f6e33e9d97..b37b75449b 100644 --- a/apps/plugins/mpegplayer/video_out_rockbox.c +++ b/apps/plugins/mpegplayer/video_out_rockbox.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "mpeg2dec_config.h" | 24 | #include "mpeg2dec_config.h" |
25 | 25 | ||
26 | #include "plugin.h" | 26 | #include "plugin.h" |
27 | #include "gray.h" | ||
27 | 28 | ||
28 | extern struct plugin_api* rb; | 29 | extern struct plugin_api* rb; |
29 | 30 | ||
@@ -188,6 +189,7 @@ static void yuv_bitmap_part(unsigned char * const src[3], | |||
188 | 189 | ||
189 | void vo_draw_frame (uint8_t * const * buf) | 190 | void vo_draw_frame (uint8_t * const * buf) |
190 | { | 191 | { |
192 | #ifdef HAVE_LCD_COLOR | ||
191 | #ifdef SIMULATOR | 193 | #ifdef SIMULATOR |
192 | yuv_bitmap_part(buf,0,0,image_width, | 194 | yuv_bitmap_part(buf,0,0,image_width, |
193 | output_x,output_y,output_width,output_height); | 195 | output_x,output_y,output_width,output_height); |
@@ -197,6 +199,10 @@ void vo_draw_frame (uint8_t * const * buf) | |||
197 | 0,0,image_width, | 199 | 0,0,image_width, |
198 | output_x,output_y,output_width,output_height); | 200 | output_x,output_y,output_width,output_height); |
199 | #endif | 201 | #endif |
202 | #else | ||
203 | gray_ub_gray_bitmap_part(buf[0],0,0,image_width, | ||
204 | output_x,output_y,output_width,output_height); | ||
205 | #endif | ||
200 | } | 206 | } |
201 | 207 | ||
202 | #if LCD_WIDTH >= LCD_HEIGHT | 208 | #if LCD_WIDTH >= LCD_HEIGHT |