1
0
Fork 0
forked from len0rd/rockbox

Fixes for the codec test environment: (1) Long aligned codec_malloc(). (2) Update all stats at most once per second.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6176 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-03-09 19:36:53 +00:00
parent bb9dfa0b02
commit 58aa4c98bb

View file

@ -36,13 +36,18 @@ unsigned char* filebuf; // The rest of the MP3 buffer
void* codec_malloc(size_t size) {
void* x;
char s[32];
static long last_tick = 0;
x=&mallocbuf[mem_ptr];
mem_ptr+=size+(size%4); // Keep memory 32-bit aligned (if it was already?)
mem_ptr+=(size+3)&~3; // Keep memory 32-bit aligned (if it was already?)
if(TIME_AFTER(*(local_rb->current_tick), last_tick + HZ)) {
local_rb->snprintf(s,30,"Memory used: %d",mem_ptr);
local_rb->lcd_putsxy(0,80,s);
last_tick = *(local_rb->current_tick);
local_rb->lcd_update();
}
return(x);
}
@ -111,6 +116,7 @@ void display_status(file_info_struct* file_info) {
unsigned long xspeed;
static long last_tick = 0;
if(TIME_AFTER(*(local_rb->current_tick), last_tick + HZ)) {
local_rb->snprintf(s,32,"Bytes read: %d",file_info->curpos);
local_rb->lcd_putsxy(0,0,s);
local_rb->snprintf(s,32,"Samples Decoded: %d",file_info->current_sample);
@ -130,13 +136,12 @@ void display_status(file_info_struct* file_info) {
if (ticks_taken==0) { ticks_taken=1; } // Avoid fp exception.
if(TIME_AFTER(*(local_rb->current_tick), last_tick + HZ)) {
last_tick = *(local_rb->current_tick);
speed=(100*file_info->current_sample)/file_info->samplerate;
xspeed=(speed*10000)/ticks_taken;
local_rb->snprintf(s,32,"Speed %ld.%02ld %% Secs: %d",(xspeed/100),(xspeed%100),ticks_taken/100);
local_rb->lcd_putsxy(0,60,s);
last_tick = *(local_rb->current_tick);
local_rb->lcd_update();
}
}
@ -204,6 +209,7 @@ int local_init(char* infilename, char* outfilename, file_info_struct* file_info,
i+=n; bytesleft-=n;
}
local_rb->close(file_info->infile);
local_rb->lcd_clear_display();
return(0);
}