From b56f10921935af57805c9c7a0069d80b1cd6ccc9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 30 Nov 2017 01:31:29 +0100 Subject: ao: minor simplification to gain processing code Cosmetic move of a variable, and consider an adjustment below 1/256 or so not worth applying (even in the float case). --- audio/out/ao.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'audio') diff --git a/audio/out/ao.c b/audio/out/ao.c index 7c2100c7d2..0acd439033 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -658,11 +658,10 @@ void ao_set_gain(struct ao *ao, float gain) static void process_plane(struct ao *ao, void *data, int num_samples) { float gain = atomic_load_explicit(&ao->gain, memory_order_relaxed); - int format = af_fmt_from_planar(ao->format); - if (gain == 1.0f) - return; int gi = lrint(256.0 * gain); - switch (format) { + if (gi == 256) + return; + switch (af_fmt_from_planar(ao->format)) { case AF_FORMAT_U8: MUL_GAIN_i((uint8_t *)data, num_samples, gi, 0, 128, 255); break; -- cgit v1.2.3