summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-09-25 19:07:56 +0000
committerJens Arnold <amiconn@rockbox.org>2005-09-25 19:07:56 +0000
commit893669cc101fc0804147f704adff47b343275c69 (patch)
treebeea5e45fa5142f5bbd7e8082f4934cfda72fb39 /firmware
parent87ebd361e26fd9a621e09510d8553a9e3e8fd268 (diff)
downloadrockbox-893669cc101fc0804147f704adff47b343275c69.tar.gz
rockbox-893669cc101fc0804147f704adff47b343275c69.tar.bz2
rockbox-893669cc101fc0804147f704adff47b343275c69.zip
Rather obvious simplification of the mpeg frametime fraction calculation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7562 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/mp3data.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/firmware/mp3data.c b/firmware/mp3data.c
index 519bc60b04..3c9264b7cc 100644
--- a/firmware/mp3data.c
+++ b/firmware/mp3data.c
@@ -158,23 +158,18 @@ static bool mp3headerinfo(struct mp3info *info, unsigned long header)
/ info->frequency + info->padding;
}
- /* Frametime fraction calculation.
- This fraction is reduced as far as possible. */
- if (freqindex != 0) { /* 48/32/24/16/12/8 kHz */
- /* integer number of milliseconds, denominator == 1 */
- info->ft_num = 1000 * info->frame_samples / info->frequency;
- info->ft_den = 1;
+ /* Frametime fraction denominator */
+ if (freqindex != 0) { /* 48/32/24/16/12/8 kHz */
+ info->ft_den = 1; /* integer number of milliseconds */
}
- else { /* 44.1/22.05/11.025 kHz */
- if (info->layer == 0) {
- info->ft_num = 147000 * 384 / info->frequency;
+ else { /* 44.1/22.05/11.025 kHz */
+ if (info->layer == 0) /* layer 1 */
info->ft_den = 147;
- }
- else {
- info->ft_num = 49000 * info->frame_samples / info->frequency;
+ else /* layer 2+3 */
info->ft_den = 49;
- }
}
+ /* Frametime fraction numerator */
+ info->ft_num = 1000 * info->ft_den * info->frame_samples / info->frequency;
info->channel_mode = (header & CHANNELMODE_MASK) >> 6;
info->mode_extension = (header & MODE_EXT_MASK) >> 4;