diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-11-23 23:54:27 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-11-23 23:54:27 +0000 |
commit | 4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0 (patch) | |
tree | e5e7c815e3e17b41bc380750374d975f76b9e6af | |
parent | fda2e32d421d050d4a5b8af8c18d3fdc12e15b8a (diff) | |
download | rockbox-4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0.tar.gz rockbox-4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0.zip |
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
-rw-r--r-- | apps/plugins/test_codec.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 3c54610a94..b1f5aff385 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c | |||
@@ -111,6 +111,7 @@ static bool taginfo_ready = true; | |||
111 | 111 | ||
112 | static volatile unsigned int elapsed; | 112 | static volatile unsigned int elapsed; |
113 | static volatile bool codec_playing; | 113 | static volatile bool codec_playing; |
114 | static volatile long endtick; | ||
114 | struct wavinfo_t wavinfo; | 115 | struct wavinfo_t wavinfo; |
115 | 116 | ||
116 | static unsigned char wav_header[44] = | 117 | static unsigned char wav_header[44] = |
@@ -508,6 +509,7 @@ static void codec_thread(void) | |||
508 | res = rb->codec_load_file(codecname,&ci); | 509 | res = rb->codec_load_file(codecname,&ci); |
509 | 510 | ||
510 | /* Signal to the main thread that we are done */ | 511 | /* Signal to the main thread that we are done */ |
512 | endtick = *rb->current_tick; | ||
511 | codec_playing = false; | 513 | codec_playing = false; |
512 | } | 514 | } |
513 | 515 | ||
@@ -519,8 +521,8 @@ static enum plugin_status test_track(const char* filename) | |||
519 | size_t n; | 521 | size_t n; |
520 | int fd; | 522 | int fd; |
521 | enum plugin_status res = PLUGIN_ERROR; | 523 | enum plugin_status res = PLUGIN_ERROR; |
522 | unsigned long starttick; | 524 | long starttick; |
523 | unsigned long ticks; | 525 | long ticks; |
524 | unsigned long speed; | 526 | unsigned long speed; |
525 | unsigned long duration; | 527 | unsigned long duration; |
526 | struct thread_entry* codecthread_id; | 528 | struct thread_entry* codecthread_id; |
@@ -601,8 +603,7 @@ static enum plugin_status test_track(const char* filename) | |||
601 | rb->snprintf(str,sizeof(str),"%d of %d",elapsed,(int)track.id3.length); | 603 | rb->snprintf(str,sizeof(str),"%d of %d",elapsed,(int)track.id3.length); |
602 | log_text(str,false); | 604 | log_text(str,false); |
603 | } | 605 | } |
604 | /* Save the current time before we spin up the disk to access the log */ | 606 | ticks = endtick - starttick; |
605 | ticks = *rb->current_tick - starttick; | ||
606 | 607 | ||
607 | /* Be sure it is done */ | 608 | /* Be sure it is done */ |
608 | rb->thread_wait(codecthread_id); | 609 | rb->thread_wait(codecthread_id); |