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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux