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:
parent
bb9dfa0b02
commit
58aa4c98bb
1 changed files with 31 additions and 25 deletions
|
@ -36,13 +36,18 @@ unsigned char* filebuf; // The rest of the MP3 buffer
|
||||||
void* codec_malloc(size_t size) {
|
void* codec_malloc(size_t size) {
|
||||||
void* x;
|
void* x;
|
||||||
char s[32];
|
char s[32];
|
||||||
|
static long last_tick = 0;
|
||||||
|
|
||||||
x=&mallocbuf[mem_ptr];
|
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->snprintf(s,30,"Memory used: %d",mem_ptr);
|
||||||
local_rb->lcd_putsxy(0,80,s);
|
local_rb->lcd_putsxy(0,80,s);
|
||||||
|
|
||||||
|
last_tick = *(local_rb->current_tick);
|
||||||
local_rb->lcd_update();
|
local_rb->lcd_update();
|
||||||
|
}
|
||||||
return(x);
|
return(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +116,7 @@ void display_status(file_info_struct* file_info) {
|
||||||
unsigned long xspeed;
|
unsigned long xspeed;
|
||||||
static long last_tick = 0;
|
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->snprintf(s,32,"Bytes read: %d",file_info->curpos);
|
||||||
local_rb->lcd_putsxy(0,0,s);
|
local_rb->lcd_putsxy(0,0,s);
|
||||||
local_rb->snprintf(s,32,"Samples Decoded: %d",file_info->current_sample);
|
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 (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;
|
speed=(100*file_info->current_sample)/file_info->samplerate;
|
||||||
xspeed=(speed*10000)/ticks_taken;
|
xspeed=(speed*10000)/ticks_taken;
|
||||||
local_rb->snprintf(s,32,"Speed %ld.%02ld %% Secs: %d",(xspeed/100),(xspeed%100),ticks_taken/100);
|
local_rb->snprintf(s,32,"Speed %ld.%02ld %% Secs: %d",(xspeed/100),(xspeed%100),ticks_taken/100);
|
||||||
local_rb->lcd_putsxy(0,60,s);
|
local_rb->lcd_putsxy(0,60,s);
|
||||||
|
|
||||||
|
last_tick = *(local_rb->current_tick);
|
||||||
local_rb->lcd_update();
|
local_rb->lcd_update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,6 +209,7 @@ int local_init(char* infilename, char* outfilename, file_info_struct* file_info,
|
||||||
i+=n; bytesleft-=n;
|
i+=n; bytesleft-=n;
|
||||||
}
|
}
|
||||||
local_rb->close(file_info->infile);
|
local_rb->close(file_info->infile);
|
||||||
|
local_rb->lcd_clear_display();
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue