[pulseaudio-discuss] Biquad LR4 for module-lfe-lp

Alexander E. Patrakov patrakov at gmail.com
Sat Mar 30 03:04:59 PDT 2013


2013/3/30 Justin Chudgar <justin at justinzane.com>:
> https://github.com/justinzane/pulseaudio.git
>
> Alexander:
>
> Now that I have a possibly working rewind implementation, Iwanted to make sure
> that I understand your guidance on doing a correct LR4. Following is what I
> currently think I need to do:
>
> - split channels into 3 sets: lowpass, highpass, and allpass
>
> - calculate the respective biquad coefficients using a Q=0.5, with one set of
> coefficients for both stages of the lp/hp/ap cascades -- that is,
>     [3][a0,a1,a2,b0,b1,b2]
>
> - use two separate data buffersfor each channel, for the first and second stages
> respectively -- that is,
>     [numchannels][2][ [y0,y1,y2,w0,w1,w2]
>
> Another question I have is whether float or double are more appropriate for the
> actual calculations. Reducing my implementation from double to float seems wise
> to me for speed and space reasons on 32bit platforms, but I'm not sure that
> loss of precision in an IIR filter is acceptable.
>
> If you review the actual code, I know it is not done to the style standards. I
> am going to clean it up once I've made sure that it is fundamentally correct.

The description above does not match the logic behind LR4 filters.
Since you are repeating the same misunderstanding over and over again,
it would be useless to review your code now, and I am nearly out of
ideas how to help you. So I will try the remaining two ideas: "use
different words" and "use a picture".

So, with different words and an example. Let's consider what you call
a highpass channel. Let's say it is the rear-left channel. You filter
it twice with a highpass filter and copy the filtered-twice result to
the corresponding output channel. During this process, the high
frequencies pass through, and the low frequencies are discarded. The
"unwanted frequencies are discarded" part is what you did wrong. They
should not be discarded. They should be extracted from the rear-left
channel (and from all other channels) with a chain of two lowpass
filters and moved to a channel capable of reproducing them - i.e., in
our case, to the subwoofer. Conversely, unwanted high frequencies
should be moved from the subwoofer, say, to the center channel or to
all other channels.

As for your use of allpass filters, I will verify separately whether
it is a valid optimization.

Regarding the biquad itself - the order of assignments in
filter_biquad() is definitely wrong. Look, w1 always ends up being
equal to w0, and y1 equal to y0.

And now the promised picture:
http://ac3filter.net/w/images/thumb/4/40/Bass_redirection_1.png/645px-Bass_redirection_1.png
. Each ^\ filter should be understood as a cascade of two Butterworth
lowpass filters, and _/ is a cascade of two Butterworth highpass
filters. As for their treatment of the subwoofer, I'd replace their
allpass filter with a lowpass, and redirect (unwanted) high
frequencies from the subwoofer to the center channel.

-- 
Alexander E. Patrakov


More information about the pulseaudio-discuss mailing list