avcodec/arm/sbcenc: avoid callee preserved vfp registers
authorJames Cowgill <jcowgill@debian.org>
Sun, 11 Aug 2019 15:50:56 +0000 (16:50 +0100)
committerPeter Michael Green <plugwash@raspbian.org>
Sun, 5 Sep 2021 20:59:14 +0000 (21:59 +0100)
commitf90ac11f0a6f3ef0a179fd80c9e24ace817fb6c2
treed4467bc28bd35c47dd74ae12fdac41c8f45cb8b9
parent48fdbda7dfc87ad604c89d943957407933ba5567
avcodec/arm/sbcenc: avoid callee preserved vfp registers

When compiling FFmpeg with GCC-9, some very random segfaults were
observed in code which had previously called down into the SBC encoder
NEON assembly routines. This was caused by these functions clobbering
some of the vfp callee saved registers (d8 - d15 aka q4 - q7). GCC was
using these registers to save local variables, but after these
functions returned, they would contain garbage.

Fix by reallocating the registers in the two affected functions in
the following way:
 ff_sbc_analyze_4_neon: q2-q5 => q8-q11, then q1-q4 => q8-q11
 ff_sbc_analyze_8_neon: q2-q9 => q8-q15

The reason for using these replacements is to keep closely related
sets of registers consecutively numbered which hopefully makes the
code more easy to follow. Since this commit only reallocates
registers, it should have no performance impact.

Signed-off-by: James Cowgill <jcowgill@debian.org>
Gbp-Pq: Name 0001-avcodec-arm-sbcenc-avoid-callee-preserved-vfp-regist.patch
libavcodec/arm/sbcdsp_neon.S