please add oil_scalarmultiply_s32_ns like oil_scalarmultiply_f32_ns. The functionallity should be similar to (taken from GstVolume): if (this->real_vol_i > VOLUME_UNITY_INT) { for (i = 0; i < num_samples; i++) { /* we use bitshifting instead of dividing by UNITY_INT for speed */ val = (gint) * data; *data++ = (gint16) CLAMP ((this->real_vol_i * val) >> VOLUME_UNITY_BIT_SHIFT, VOLUME_MIN_INT16, VOLUME_MAX_INT16); } } else { for (i = 0; i < num_samples; i++) { /* we use bitshifting instead of dividing by UNITY_INT for speed */ val = (gint) * data; *data++ = (gint16) ((this->real_vol_i * val) >> VOLUME_UNITY_BIT_SHIFT); } } It would be okay to have two functions, one with CLAMP and one without.

What about having oil_scalarmultiply_s32_ns (int32 *d, int32 *s1, int32 *s2_1, int32 *s2_2, int n) which does if (*s2_1 < *s2_2) for (i = 0; i < n; i++) { d[i] = (s1[i] * (*s2_1)) / (*s2_2); } else for (i = 0; i < n; i++) { d[i] = CLAMP ((s1[i] * (*s2_1)) / (*s2_2), MININT32, MAXINT32); } Only needs to take care of putting s1[i] * (*s2_1) into int64 (and docs should say that it does clipping). IIRC MMX or MMXExt provides something to multiply and store in the next larger value type so it could be implemented for this at least... or was it some version of SSE? Whatever, if the API is fine I'll look it up again :) Also this function could be made available for 8 and 16 bits maybe, not sure about 64 or 24 bits...