#include <speex/speex_resampler.h>
-#include <liboil/liboilfuncs.h>
-#include <liboil/liboil.h>
-
#include <pulse/xmalloc.h>
#include <pulsecore/sconv.h>
#include <pulsecore/log.h>
return &r->buf1;
}
-static void vectoradd_s16_with_fraction(
- int16_t *d, int dstr,
- const int16_t *s1, int sstr1,
- const int16_t *s2, int sstr2,
- int n,
- float s3, float s4) {
+static void vectoradd_f32(
+ float *d, int dstr,
+ const float *s, int sstr,
+ int n, float s4) {
- int32_t i3, i4;
+ for (; n > 0; n--) {
+ *d = (float) (*d + (s4 * *s));
- i3 = (int32_t) (s3 * 0x10000);
- i4 = (int32_t) (s4 * 0x10000);
+ s = (const float*) ((const uint8_t*) s + sstr);
+ d = (float*) ((uint8_t*) d + dstr);
+ }
+}
+
+static void vectoradd_s16(
+ int16_t *d, int dstr,
+ const int16_t *s, int sstr,
+ int n) {
for (; n > 0; n--) {
- int32_t a, b;
+ *d = (int16_t) (*d + *s);
- a = *s1;
- b = *s2;
+ s = (const int16_t*) ((const uint8_t*) s + sstr);
+ d = (int16_t*) ((uint8_t*) d + dstr);
+ }
+}
- a = (a * i3) / 0x10000;
- b = (b * i4) / 0x10000;
+static void vectoradd_s16_with_fraction(
+ int16_t *d, int dstr,
+ const int16_t *s, int sstr,
+ int n, float s4) {
- *d = (int16_t) (a + b);
+ int32_t i4;
- s1 = (const int16_t*) ((const uint8_t*) s1 + sstr1);
- s2 = (const int16_t*) ((const uint8_t*) s2 + sstr2);
- d = (int16_t*) ((uint8_t*) d + dstr);
+ i4 = (int32_t) (s4 * 0x10000);
+
+ for (; n > 0; n--) {
+ *d = (int16_t) (*d + (((int32_t)*s * i4) >> 16));
+ s = (const int16_t*) ((const uint8_t*) s + sstr);
+ d = (int16_t*) ((uint8_t*) d + dstr);
}
}
if (r->map_table[oc][ic] <= 0.0)
continue;
- oil_vectoradd_f32(
- (float*) dst + oc, o_skip,
+ vectoradd_f32(
(float*) dst + oc, o_skip,
(float*) src + ic, i_skip,
(int) n_frames,
- &one, &r->map_table[oc][ic]);
+ r->map_table[oc][ic]);
}
}
continue;
if (r->map_table[oc][ic] >= 1.0) {
- static const int16_t one = 1;
- oil_vectoradd_s16(
- (int16_t*) dst + oc, o_skip,
+ vectoradd_s16(
(int16_t*) dst + oc, o_skip,
(int16_t*) src + ic, i_skip,
- (int) n_frames,
- &one, &one);
+ (int) n_frames);
} else
vectoradd_s16_with_fraction(
- (int16_t*) dst + oc, o_skip,
(int16_t*) dst + oc, o_skip,
(int16_t*) src + ic, i_skip,
(int) n_frames,
- 1.0f, r->map_table[oc][ic]);
+ r->map_table[oc][ic]);
}
}
pa_assert(o_index * fz < pa_memblock_get_length(output->memblock));
- oil_memcpy((uint8_t*) dst + fz * o_index,
+ memcpy((uint8_t*) dst + fz * o_index,
(uint8_t*) src + fz * j, (int) fz);
}