0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00

Merge pull request #112 from antihax/Opt

Slight modification of audio mixing function
This commit is contained in:
Jim 2014-06-11 06:38:26 -07:00
commit c6712ab462

View File

@ -197,9 +197,16 @@ static void mix_float(uint8_t *mix_in, struct circlebuf *buf, size_t size)
circlebuf_pop_front(buf, vals, pop_count);
pop_count /= sizeof(float);
/* This sequence provides hints for MSVC to use packed SSE
* instructions addps, minps, maxps, etc. */
for (size_t i = 0; i < pop_count; i++) {
mix_val = *mix + vals[i];
*(mix++) = CLAMP(mix_val, -1.0f, 1.0f);
/* clamp confuses the optimisation */
mix_val = (mix_val > 1.0f) ? 1.0f : mix_val;
mix_val = (mix_val < -1.0f) ? -1.0f : mix_val;
*(mix++) = mix_val;
}
}
}