[pulseaudio-discuss] [PATCH 3/6 v3] core: Add stereo to mono special case remapping

Arun Raghavan arun.raghavan at collabora.co.uk
Thu Oct 18 00:15:16 PDT 2012


On Wed, 2012-10-17 at 16:20 +0200, Peter Meerwald wrote:
> 
> > > +static void remap_stereo_to_mono_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
> > > +    unsigned i;
> > > +
> > > +    switch (*m->format) {
> > > +        case PA_SAMPLE_FLOAT32NE:
> > > +        {
> > > +            float *d = (float *) dst, *s = (float *) src;
> > > +
> > > +            for (i = n >> 2; i > 0; i--) {
> > > +                d[0] = s[0] + s[1];
> > > +                d[1] = s[2] + s[3];
> > > +                d[2] = s[4] + s[5];
> > > +                d[3] = s[6] + s[7];
> > > +                s += 8;
> > > +                d += 4;
> > > +            }
> > > +            for (i = n & 3; i; i--) {
> 
> > Shouldn't this (and the next case) be (n & 2)?
> 
> the first loop processes floor(n/4)*4 elements, the second loop processes 
> the remaining n % 4 == n & 3 elements

D'oh! Sorry, that was a brainfart -- read 3 bits instead of numeric 3.

-- Arun




More information about the pulseaudio-discuss mailing list