[pulseaudio-discuss] [PATCH v2] resampler: Fix volume on downmix to mono

Tanu Kaskinen tanuk at iki.fi
Thu Aug 9 09:49:04 PDT 2012


On Thu, 2012-08-09 at 14:21 +0200, David Henningsson wrote:
> Patch credit: kwanghui
> 
> When downmixing to mono, we should average the signal instead of
> summing it to avoid clipping.

I believe the "correct" thing to do is to sum when downmixing and to
divide when upmixing. That won't help with the clipping problem in most
cases, though. It would help when the downmixing follows upmixing, but I
guess that pretty much never happens.

So, I'm leaning towards agreeing with this patch.

> @@ -759,12 +759,19 @@ static void calc_map_table(pa_resampler *r) {
>               * best to pass it to L+R.
>               */
>  
> -            if (a == b || a == PA_CHANNEL_POSITION_MONO || b == PA_CHANNEL_POSITION_MONO) {
> +            if (a == b || a == PA_CHANNEL_POSITION_MONO) {
>                  m->map_table_f[oc][ic] = 1.0;
>  
>                  oc_connected = TRUE;
>                  ic_connected[ic] = TRUE;
>              }
> +            else if (b == PA_CHANNEL_POSITION_MONO) {
> +                if(n_ic)

Missing space.

-- 
Tanu



More information about the pulseaudio-discuss mailing list