ref: 32f66877d438744c08476c1e7d04623cb5cffcea
parent: 247ea8367395a95e5be2a7a9c5dfb8025a3f367e
author: Siarhei Volkau <lis8215@gmail.com>
date: Tue Sep 2 18:46:04 EDT 2025
opus_decode24: prevent aliasing pcm and st->channels Both GCC and clang think that pcm and st->channels might alias thus opus_decode24 is doing extra load+multiplication on each sample. Moreover, aliasing prevents autovectorization of that loop. Signed-off-by: Siarhei Volkau <lis8215@gmail.com> Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -931,7 +931,8 @@
ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0, NULL, 0);
if (ret > 0)
{
- for (i=0;i<ret*st->channels;i++)
+ nb_samples = ret*st->channels;
+ for (i=0;i<nb_samples;i++)
pcm[i] = RES2INT24(out[i]);
}
RESTORE_STACK;
--
⑨