Implement a Neon optimized function to find the argmax element in an array.

Finding the array element with the largest argmax is a fairly common
operation, so it makes sense to have a Neon optimized version. The
implementation is done by first finding both the min and max value, and
then returning whichever has the largest argmax.

Bug: chromium:12355
Change-Id: I088bd4f7d469b2424a7265de10fffb42764567a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201622
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33052}
This commit is contained in:
Ivo Creusen
2021-01-20 16:26:43 +01:00
committed by Commit Bot
parent 03eed7c8d0
commit 6031b74664
6 changed files with 169 additions and 8 deletions

View File

@ -205,9 +205,9 @@ size_t // (o) Estimated lag in end of in[]
/* scaling */
// Note that this is not abs-max, so we will take the absolute value below.
max16 = regressor[WebRtcSpl_MaxAbsIndexW16(regressor, plc_blockl + 3 - 1)];
max16 = WebRtcSpl_MaxAbsElementW16(regressor, plc_blockl + 3 - 1);
const int16_t max_target =
target[WebRtcSpl_MaxAbsIndexW16(target, plc_blockl + 3 - 1)];
WebRtcSpl_MaxAbsElementW16(target, plc_blockl + 3 - 1);
const int64_t max_val = plc_blockl * abs(max16 * max_target);
const int32_t factor = max_val >> 31;
shifts = factor == 0 ? 0 : 31 - WebRtcSpl_NormW32(factor);