1
0
Fork 0
forked from len0rd/rockbox

Fix test_codec precision. The old version effectively rounded the decode time up to full seconds (because of the rb->sleep(HZ)), so speed results from before this revision were more or less too low and 'stepped', especially for fast codecs and short test tracks.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19193 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2008-11-23 23:54:27 +00:00
parent fda2e32d42
commit 4c3a19f1b4

View file

@ -111,6 +111,7 @@ static bool taginfo_ready = true;
static volatile unsigned int elapsed; static volatile unsigned int elapsed;
static volatile bool codec_playing; static volatile bool codec_playing;
static volatile long endtick;
struct wavinfo_t wavinfo; struct wavinfo_t wavinfo;
static unsigned char wav_header[44] = static unsigned char wav_header[44] =
@ -508,6 +509,7 @@ static void codec_thread(void)
res = rb->codec_load_file(codecname,&ci); res = rb->codec_load_file(codecname,&ci);
/* Signal to the main thread that we are done */ /* Signal to the main thread that we are done */
endtick = *rb->current_tick;
codec_playing = false; codec_playing = false;
} }
@ -519,8 +521,8 @@ static enum plugin_status test_track(const char* filename)
size_t n; size_t n;
int fd; int fd;
enum plugin_status res = PLUGIN_ERROR; enum plugin_status res = PLUGIN_ERROR;
unsigned long starttick; long starttick;
unsigned long ticks; long ticks;
unsigned long speed; unsigned long speed;
unsigned long duration; unsigned long duration;
struct thread_entry* codecthread_id; struct thread_entry* codecthread_id;
@ -601,8 +603,7 @@ static enum plugin_status test_track(const char* filename)
rb->snprintf(str,sizeof(str),"%d of %d",elapsed,(int)track.id3.length); rb->snprintf(str,sizeof(str),"%d of %d",elapsed,(int)track.id3.length);
log_text(str,false); log_text(str,false);
} }
/* Save the current time before we spin up the disk to access the log */ ticks = endtick - starttick;
ticks = *rb->current_tick - starttick;
/* Be sure it is done */ /* Be sure it is done */
rb->thread_wait(codecthread_id); rb->thread_wait(codecthread_id);