1
0
Fork 0
forked from len0rd/rockbox

mpegplayer for grayscale targets. Note that performance is slow...

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12913 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2007-03-26 01:32:31 +00:00
parent 8f04faef91
commit a56757137c
4 changed files with 46 additions and 6 deletions

View file

@ -31,10 +31,9 @@ pacbox
doom doom
#endif #endif
/* For all the colour targets */ /* For all the swcodec targets */
#if defined(HAVE_LCD_COLOR) #if CONFIG_CODEC == SWCODEC
mpegplayer mpegplayer
#endif #endif
#endif /* IRIVER_IFP7XX_SERIES */ #endif /* IRIVER_IFP7XX_SERIES */

View file

@ -8,7 +8,7 @@
# #
INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
-I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(APPSDIR)/plugins/lib -I$(OUTDIR) -I$(BUILDDIR)
CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \ CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN

View file

@ -103,6 +103,7 @@ FPS | 27Mhz | 100Hz | 44.1KHz | 48KHz
#include "mpeg2dec_config.h" #include "mpeg2dec_config.h"
#include "plugin.h" #include "plugin.h"
#include "gray.h"
#include "mpeg2.h" #include "mpeg2.h"
#include "mpeg_settings.h" #include "mpeg_settings.h"
@ -270,8 +271,16 @@ static void button_loop(void)
/* Wait for video thread to stop */ /* Wait for video thread to stop */
while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); } while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); }
} }
#ifndef HAVE_LCD_COLOR
gray_show(false);
#endif
result = mpeg_menu(); result = mpeg_menu();
#ifndef HAVE_LCD_COLOR
gray_show(true);
#endif
/* The menu can change the font, so restore */ /* The menu can change the font, so restore */
rb->lcd_setfont(FONT_SYSFIXED); rb->lcd_setfont(FONT_SYSFIXED);
@ -911,6 +920,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
size_t file_remaining; size_t file_remaining;
size_t n; size_t n;
size_t disk_buf_len; size_t disk_buf_len;
#ifndef HAVE_LCD_COLOR
long graysize;
int grayscales;
#endif
/* We define this here so it is on the main stack (in IRAM) */ /* We define this here so it is on the main stack (in IRAM) */
mad_fixed_t mad_frame_overlap[2][32][18]; /* 4608 bytes */ mad_fixed_t mad_frame_overlap[2][32][18]; /* 4608 bytes */
@ -939,14 +952,28 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
PCM audio data and some for libmpeg2 malloc use. */ PCM audio data and some for libmpeg2 malloc use. */
buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE); buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE);
DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size);
buffer_size &= ~(0x7ff); /* Round buffer down to nearest 2KB */
DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size); DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size);
buffer = mpeg2_malloc(buffer_size,-1); buffer = mpeg2_malloc(buffer_size,-1);
if (buffer == NULL) if (buffer == NULL)
return PLUGIN_ERROR; return PLUGIN_ERROR;
#ifndef HAVE_LCD_COLOR
/* initialize the grayscale buffer: 32 bitplanes for 33 shades of gray. */
grayscales = gray_init(rb, buffer, buffer_size, false, LCD_WIDTH, LCD_HEIGHT,
32, 2<<8, &graysize) + 1;
buffer += graysize;
buffer_size -= graysize;
if (grayscales < 33 || buffer_size <= 0)
{
rb->splash(HZ, "gray buf error");
return PLUGIN_ERROR;
}
#endif
buffer_size &= ~(0x7ff); /* Round buffer down to nearest 2KB */
DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size);
mpa_buffer_size = AUDIOBUFFER_SIZE; mpa_buffer_size = AUDIOBUFFER_SIZE;
mpa_buffer = mpeg2_malloc(mpa_buffer_size,-2); mpa_buffer = mpeg2_malloc(mpa_buffer_size,-2);
@ -1026,6 +1053,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
audiostatus = STREAM_BUFFERING; audiostatus = STREAM_BUFFERING;
videostatus = STREAM_PLAYING; videostatus = STREAM_PLAYING;
#ifndef HAVE_LCD_COLOR
gray_show(true);
#endif
/* We put the video thread on the second processor for multi-core targets. */ /* We put the video thread on the second processor for multi-core targets. */
if ((videothread_id = rb->create_thread(video_thread, if ((videothread_id = rb->create_thread(video_thread,
(uint8_t*)video_stack,VIDEO_STACKSIZE,"mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) (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)
rb->sleep(HZ/10); rb->sleep(HZ/10);
} }
#ifndef HAVE_LCD_COLOR
gray_release();
#endif
rb->remove_thread(audiothread_id); rb->remove_thread(audiothread_id);
rb->yield(); /* Is this needed? */ rb->yield(); /* Is this needed? */

View file

@ -24,6 +24,7 @@
#include "mpeg2dec_config.h" #include "mpeg2dec_config.h"
#include "plugin.h" #include "plugin.h"
#include "gray.h"
extern struct plugin_api* rb; extern struct plugin_api* rb;
@ -188,6 +189,7 @@ static void yuv_bitmap_part(unsigned char * const src[3],
void vo_draw_frame (uint8_t * const * buf) void vo_draw_frame (uint8_t * const * buf)
{ {
#ifdef HAVE_LCD_COLOR
#ifdef SIMULATOR #ifdef SIMULATOR
yuv_bitmap_part(buf,0,0,image_width, yuv_bitmap_part(buf,0,0,image_width,
output_x,output_y,output_width,output_height); output_x,output_y,output_width,output_height);
@ -197,6 +199,10 @@ void vo_draw_frame (uint8_t * const * buf)
0,0,image_width, 0,0,image_width,
output_x,output_y,output_width,output_height); output_x,output_y,output_width,output_height);
#endif #endif
#else
gray_ub_gray_bitmap_part(buf[0],0,0,image_width,
output_x,output_y,output_width,output_height);
#endif
} }
#if LCD_WIDTH >= LCD_HEIGHT #if LCD_WIDTH >= LCD_HEIGHT