> > +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[0] = s[0] + s[1]; > > + s += 2; > > + d += 1; > > + } > > + break; > > + } > > + case PA_SAMPLE_S16NE: > > + { > > + int16_t *d = (int16_t *) dst, *s = (int16_t *) src; > > + > > + for (i = n >> 2; i > 0; i--) { > > + *d++ += s[0] + s[1]; > > + *d++ += s[2] + s[3]; > > + *d++ += s[4] + s[5]; > > + *d++ += s[6] + s[7]; > > + s += 8; > > + } > Out of curiosity, is there a reason that you index d in the first case > and increment it in the second? no; this should be made consistent I'll collect further comments and send out a v4 in due time > > + for (i = n & 3; i; i--) { > > + *d++ += s[0] + s[1]; > > + s += 2; > > + } > > + break; > > + } > > + default: > > + pa_assert_not_reached(); > > + } > > +} -- Peter Meerwald +43-664-2444418 (mobile)