[linux-audio-dev] algorithm latency.

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] algorithm latency.
From: Mark Taylor (mt_AT_sulaco.org)
Date: Mon Jul 10 2000 - 23:12:09 EEST


Hi Everyone,

I've been reading all these email messages about
OS latency, and figured I'd ask a slightly related
question:

In MP3 encoding, there is a lot of built in latency
in the actual algorithms: encode a .wav, decode it, and
the decoded file starts N samples later than the original.

This comes up a lot in the mp3encoder mailing list, and
many people want to know *exactly* what N is. I tried to
work this out and tracked it down to two algorithms:

1. MDCT.

The MDCT followed by inverse MDCT is starightfoward to analize, and I
am pretty sure the delay this introduces (for the wacky MDCT sizes
and implementation used by MP3) is 576 samples.

2. polyphase filterbank.

MP3 also uses a lossy "polyphase" filterbank, inherited from
MPEG layer 2. (which must have been designed before the audio
engineers learned about the lossless MDCT?)

I never tried to figure out exactly what is going on in here.
But from a coding standpoint, it looks like a black box which holds
512 samples. You shift in 32 samples at a time, and get out 32 samples
out (1 sample for each of 32 filterbanks).

I always thought of these 32 output samples as representing
the same amount of time as 32 samples centered in the
512 analysis window = samples [240,271]. Distance between
samples [240,271] and [0,31] = a delay of 240 samples. But if you
treat the window as periodic, with period 512, then the center of the
window is actually samples [240.5,271.5], giving a delay of 240.5.
Total delay (foward and inverse) 480 or 481.

Thus the total delay (forward and inverse MDCT and filterbank)
could be either 1056 or 1057. 1057 agrees with observations,
so I want to conclude that the filterbank delay must be 240.5,
but I worried I'm cooking the analysis to agree with observations :-)

Mark


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Jul 10 2000 - 23:44:22 EEST