summaryrefslogtreecommitdiffstats
path: root/audio/out/ao.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-11-30 01:31:29 +0100
committerwm4 <wm4@nowhere>2017-11-30 01:31:37 +0100
commitb56f10921935af57805c9c7a0069d80b1cd6ccc9 (patch)
treecf78f35472763c44f41f7c916ff0737f0c36d05e /audio/out/ao.c
parent6f8cf73f54c4b1f80d69ecd30d269f16df70ef6e (diff)
downloadmpv-b56f10921935af57805c9c7a0069d80b1cd6ccc9.tar.bz2
mpv-b56f10921935af57805c9c7a0069d80b1cd6ccc9.tar.xz
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).
Diffstat (limited to 'audio/out/ao.c')
-rw-r--r--audio/out/ao.c7
1 files changed, 3 insertions, 4 deletions
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;