2013-02-21 20:12:21 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This file contains the implementation of function
|
|
|
|
|
* WebRtcSpl_MaxAbsValueW16()
|
|
|
|
|
*
|
|
|
|
|
* The description header can be found in signal_processing_library.h.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "common_audio/signal_processing/include/signal_processing_library.h"
|
2025-01-09 02:11:09 -08:00
|
|
|
#include "rtc_base/checks.h"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
|
|
|
|
// Maximum absolute value of word16 vector.
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
int16_t WebRtcSpl_MaxAbsValueW16_mips(const int16_t* vector, size_t length) {
|
2013-04-09 16:40:28 +00:00
|
|
|
int32_t totMax = 0;
|
|
|
|
|
int32_t tmp32_0, tmp32_1, tmp32_2, tmp32_3;
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
size_t i, loop_size;
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2016-08-26 04:33:34 -07:00
|
|
|
RTC_DCHECK_GT(length, 0);
|
2015-08-28 17:31:03 -07:00
|
|
|
|
2013-02-21 20:12:21 +00:00
|
|
|
#if defined(MIPS_DSP_R1)
|
2013-04-09 16:40:28 +00:00
|
|
|
const int32_t* tmpvec32 = (int32_t*)vector;
|
2013-02-21 20:12:21 +00:00
|
|
|
loop_size = length >> 4;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < loop_size; i++) {
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
"lw %[tmp32_0], 0(%[tmpvec32]) \n\t"
|
|
|
|
|
"lw %[tmp32_1], 4(%[tmpvec32]) \n\t"
|
|
|
|
|
"lw %[tmp32_2], 8(%[tmpvec32]) \n\t"
|
|
|
|
|
"lw %[tmp32_3], 12(%[tmpvec32]) \n\t"
|
|
|
|
|
|
|
|
|
|
"absq_s.ph %[tmp32_0], %[tmp32_0] \n\t"
|
|
|
|
|
"absq_s.ph %[tmp32_1], %[tmp32_1] \n\t"
|
|
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_0], %[totMax] \n\t"
|
|
|
|
|
|
|
|
|
|
"lw %[tmp32_0], 16(%[tmpvec32]) \n\t"
|
|
|
|
|
"absq_s.ph %[tmp32_2], %[tmp32_2] \n\t"
|
|
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_1] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_1], %[totMax] \n\t"
|
|
|
|
|
|
|
|
|
|
"lw %[tmp32_1], 20(%[tmpvec32]) \n\t"
|
|
|
|
|
"absq_s.ph %[tmp32_3], %[tmp32_3] \n\t"
|
|
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_2] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_2], %[totMax] \n\t"
|
|
|
|
|
|
|
|
|
|
"lw %[tmp32_2], 24(%[tmpvec32]) \n\t"
|
|
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_3] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_3], %[totMax] \n\t"
|
|
|
|
|
|
|
|
|
|
"lw %[tmp32_3], 28(%[tmpvec32]) \n\t"
|
|
|
|
|
"absq_s.ph %[tmp32_0], %[tmp32_0] \n\t"
|
|
|
|
|
"absq_s.ph %[tmp32_1], %[tmp32_1] \n\t"
|
|
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_0], %[totMax] \n\t"
|
|
|
|
|
|
|
|
|
|
"absq_s.ph %[tmp32_2], %[tmp32_2] \n\t"
|
|
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_1] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_1], %[totMax] \n\t"
|
|
|
|
|
"absq_s.ph %[tmp32_3], %[tmp32_3] \n\t"
|
|
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_2] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_2], %[totMax] \n\t"
|
|
|
|
|
|
|
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_3] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_3], %[totMax] \n\t"
|
|
|
|
|
|
|
|
|
|
"addiu %[tmpvec32], %[tmpvec32], 32 \n\t"
|
|
|
|
|
: [tmp32_0] "=&r"(tmp32_0), [tmp32_1] "=&r"(tmp32_1),
|
|
|
|
|
[tmp32_2] "=&r"(tmp32_2), [tmp32_3] "=&r"(tmp32_3),
|
|
|
|
|
[totMax] "+r"(totMax), [tmpvec32] "+r"(tmpvec32)
|
|
|
|
|
:
|
|
|
|
|
: "memory");
|
|
|
|
|
}
|
|
|
|
|
__asm__ volatile(
|
|
|
|
|
"rotr %[tmp32_0], %[totMax], 16 \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
"cmp.lt.ph %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"pick.ph %[totMax], %[tmp32_0], %[totMax] \n\t"
|
2025-01-09 02:11:09 -08:00
|
|
|
"packrl.ph %[totMax], $0, %[totMax] \n\t"
|
|
|
|
|
: [tmp32_0] "=&r"(tmp32_0), [totMax] "+r"(totMax)
|
|
|
|
|
:);
|
2013-02-21 20:12:21 +00:00
|
|
|
loop_size = length & 0xf;
|
|
|
|
|
for (i = 0; i < loop_size; i++) {
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
"lh %[tmp32_0], 0(%[tmpvec32]) \n\t"
|
|
|
|
|
"addiu %[tmpvec32], %[tmpvec32], 2 \n\t"
|
|
|
|
|
"absq_s.w %[tmp32_0], %[tmp32_0] \n\t"
|
|
|
|
|
"slt %[tmp32_1], %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_0], %[tmp32_1] \n\t"
|
|
|
|
|
: [tmp32_0] "=&r"(tmp32_0), [tmp32_1] "=&r"(tmp32_1),
|
|
|
|
|
[tmpvec32] "+r"(tmpvec32), [totMax] "+r"(totMax)
|
|
|
|
|
:
|
|
|
|
|
: "memory");
|
2013-02-21 20:12:21 +00:00
|
|
|
}
|
2025-01-09 02:11:09 -08:00
|
|
|
#else // #if defined(MIPS_DSP_R1)
|
2013-04-09 16:40:28 +00:00
|
|
|
int32_t v16MaxMax = WEBRTC_SPL_WORD16_MAX;
|
|
|
|
|
int32_t r, r1, r2, r3;
|
|
|
|
|
const int16_t* tmpvector = vector;
|
2013-02-21 20:12:21 +00:00
|
|
|
loop_size = length >> 4;
|
|
|
|
|
for (i = 0; i < loop_size; i++) {
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
"lh %[tmp32_0], 0(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_1], 2(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_2], 4(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_3], 6(%[tmpvector]) \n\t"
|
|
|
|
|
|
|
|
|
|
"abs %[tmp32_0], %[tmp32_0] \n\t"
|
|
|
|
|
"abs %[tmp32_1], %[tmp32_1] \n\t"
|
|
|
|
|
"abs %[tmp32_2], %[tmp32_2] \n\t"
|
|
|
|
|
"abs %[tmp32_3], %[tmp32_3] \n\t"
|
|
|
|
|
|
|
|
|
|
"slt %[r], %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_0], %[r] \n\t"
|
|
|
|
|
"slt %[r1], %[totMax], %[tmp32_1] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_1], %[r1] \n\t"
|
|
|
|
|
"slt %[r2], %[totMax], %[tmp32_2] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_2], %[r2] \n\t"
|
|
|
|
|
"slt %[r3], %[totMax], %[tmp32_3] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_3], %[r3] \n\t"
|
|
|
|
|
|
|
|
|
|
"lh %[tmp32_0], 8(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_1], 10(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_2], 12(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_3], 14(%[tmpvector]) \n\t"
|
|
|
|
|
|
|
|
|
|
"abs %[tmp32_0], %[tmp32_0] \n\t"
|
|
|
|
|
"abs %[tmp32_1], %[tmp32_1] \n\t"
|
|
|
|
|
"abs %[tmp32_2], %[tmp32_2] \n\t"
|
|
|
|
|
"abs %[tmp32_3], %[tmp32_3] \n\t"
|
|
|
|
|
|
|
|
|
|
"slt %[r], %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_0], %[r] \n\t"
|
|
|
|
|
"slt %[r1], %[totMax], %[tmp32_1] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_1], %[r1] \n\t"
|
|
|
|
|
"slt %[r2], %[totMax], %[tmp32_2] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_2], %[r2] \n\t"
|
|
|
|
|
"slt %[r3], %[totMax], %[tmp32_3] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_3], %[r3] \n\t"
|
|
|
|
|
|
|
|
|
|
"lh %[tmp32_0], 16(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_1], 18(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_2], 20(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_3], 22(%[tmpvector]) \n\t"
|
|
|
|
|
|
|
|
|
|
"abs %[tmp32_0], %[tmp32_0] \n\t"
|
|
|
|
|
"abs %[tmp32_1], %[tmp32_1] \n\t"
|
|
|
|
|
"abs %[tmp32_2], %[tmp32_2] \n\t"
|
|
|
|
|
"abs %[tmp32_3], %[tmp32_3] \n\t"
|
|
|
|
|
|
|
|
|
|
"slt %[r], %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_0], %[r] \n\t"
|
|
|
|
|
"slt %[r1], %[totMax], %[tmp32_1] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_1], %[r1] \n\t"
|
|
|
|
|
"slt %[r2], %[totMax], %[tmp32_2] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_2], %[r2] \n\t"
|
|
|
|
|
"slt %[r3], %[totMax], %[tmp32_3] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_3], %[r3] \n\t"
|
|
|
|
|
|
|
|
|
|
"lh %[tmp32_0], 24(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_1], 26(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_2], 28(%[tmpvector]) \n\t"
|
|
|
|
|
"lh %[tmp32_3], 30(%[tmpvector]) \n\t"
|
|
|
|
|
|
|
|
|
|
"abs %[tmp32_0], %[tmp32_0] \n\t"
|
|
|
|
|
"abs %[tmp32_1], %[tmp32_1] \n\t"
|
|
|
|
|
"abs %[tmp32_2], %[tmp32_2] \n\t"
|
|
|
|
|
"abs %[tmp32_3], %[tmp32_3] \n\t"
|
|
|
|
|
|
|
|
|
|
"slt %[r], %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_0], %[r] \n\t"
|
|
|
|
|
"slt %[r1], %[totMax], %[tmp32_1] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_1], %[r1] \n\t"
|
|
|
|
|
"slt %[r2], %[totMax], %[tmp32_2] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_2], %[r2] \n\t"
|
|
|
|
|
"slt %[r3], %[totMax], %[tmp32_3] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_3], %[r3] \n\t"
|
|
|
|
|
|
|
|
|
|
"addiu %[tmpvector], %[tmpvector], 32 \n\t"
|
|
|
|
|
: [tmp32_0] "=&r"(tmp32_0), [tmp32_1] "=&r"(tmp32_1),
|
|
|
|
|
[tmp32_2] "=&r"(tmp32_2), [tmp32_3] "=&r"(tmp32_3),
|
|
|
|
|
[totMax] "+r"(totMax), [r] "=&r"(r), [tmpvector] "+r"(tmpvector),
|
|
|
|
|
[r1] "=&r"(r1), [r2] "=&r"(r2), [r3] "=&r"(r3)
|
|
|
|
|
:
|
|
|
|
|
: "memory");
|
2013-02-21 20:12:21 +00:00
|
|
|
}
|
|
|
|
|
loop_size = length & 0xf;
|
|
|
|
|
for (i = 0; i < loop_size; i++) {
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
"lh %[tmp32_0], 0(%[tmpvector]) \n\t"
|
|
|
|
|
"addiu %[tmpvector], %[tmpvector], 2 \n\t"
|
|
|
|
|
"abs %[tmp32_0], %[tmp32_0] \n\t"
|
|
|
|
|
"slt %[tmp32_1], %[totMax], %[tmp32_0] \n\t"
|
|
|
|
|
"movn %[totMax], %[tmp32_0], %[tmp32_1] \n\t"
|
|
|
|
|
: [tmp32_0] "=&r"(tmp32_0), [tmp32_1] "=&r"(tmp32_1),
|
|
|
|
|
[tmpvector] "+r"(tmpvector), [totMax] "+r"(totMax)
|
|
|
|
|
:
|
|
|
|
|
: "memory");
|
2013-02-21 20:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
"slt %[r], %[v16MaxMax], %[totMax] \n\t"
|
|
|
|
|
"movn %[totMax], %[v16MaxMax], %[r] \n\t"
|
|
|
|
|
: [totMax] "+r"(totMax), [r] "=&r"(r)
|
|
|
|
|
: [v16MaxMax] "r"(v16MaxMax));
|
2013-02-21 20:12:21 +00:00
|
|
|
#endif // #if defined(MIPS_DSP_R1)
|
|
|
|
|
return (int16_t)totMax;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if defined(MIPS_DSP_R1_LE)
|
|
|
|
|
// Maximum absolute value of word32 vector. Version for MIPS platform.
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
int32_t WebRtcSpl_MaxAbsValueW32_mips(const int32_t* vector, size_t length) {
|
2013-02-21 20:12:21 +00:00
|
|
|
// Use uint32_t for the local variables, to accommodate the return value
|
|
|
|
|
// of abs(0x80000000), which is 0x80000000.
|
|
|
|
|
|
|
|
|
|
uint32_t absolute = 0, maximum = 0;
|
|
|
|
|
int tmp1 = 0, max_value = 0x7fffffff;
|
|
|
|
|
|
2016-08-26 04:33:34 -07:00
|
|
|
RTC_DCHECK_GT(length, 0);
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
".set push \n\t"
|
|
|
|
|
".set noreorder \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
"1: \n\t"
|
|
|
|
|
"lw %[absolute], 0(%[vector]) \n\t"
|
|
|
|
|
"absq_s.w %[absolute], %[absolute] \n\t"
|
|
|
|
|
"addiu %[length], %[length], -1 \n\t"
|
|
|
|
|
"slt %[tmp1], %[maximum], %[absolute] \n\t"
|
|
|
|
|
"movn %[maximum], %[absolute], %[tmp1] \n\t"
|
|
|
|
|
"bgtz %[length], 1b \n\t"
|
|
|
|
|
" addiu %[vector], %[vector], 4 \n\t"
|
|
|
|
|
"slt %[tmp1], %[max_value], %[maximum] \n\t"
|
|
|
|
|
"movn %[maximum], %[max_value], %[tmp1] \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
".set pop \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
: [tmp1] "=&r"(tmp1), [maximum] "+r"(maximum), [absolute] "+r"(absolute)
|
|
|
|
|
: [vector] "r"(vector), [length] "r"(length), [max_value] "r"(max_value)
|
|
|
|
|
: "memory");
|
2013-02-21 20:12:21 +00:00
|
|
|
|
|
|
|
|
return (int32_t)maximum;
|
|
|
|
|
}
|
|
|
|
|
#endif // #if defined(MIPS_DSP_R1_LE)
|
|
|
|
|
|
|
|
|
|
// Maximum value of word16 vector. Version for MIPS platform.
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
int16_t WebRtcSpl_MaxValueW16_mips(const int16_t* vector, size_t length) {
|
2013-02-21 20:12:21 +00:00
|
|
|
int16_t maximum = WEBRTC_SPL_WORD16_MIN;
|
|
|
|
|
int tmp1;
|
|
|
|
|
int16_t value;
|
|
|
|
|
|
2016-08-26 04:33:34 -07:00
|
|
|
RTC_DCHECK_GT(length, 0);
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
".set push \n\t"
|
|
|
|
|
".set noreorder \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
"1: \n\t"
|
|
|
|
|
"lh %[value], 0(%[vector]) \n\t"
|
|
|
|
|
"addiu %[length], %[length], -1 \n\t"
|
|
|
|
|
"slt %[tmp1], %[maximum], %[value] \n\t"
|
|
|
|
|
"movn %[maximum], %[value], %[tmp1] \n\t"
|
|
|
|
|
"bgtz %[length], 1b \n\t"
|
|
|
|
|
" addiu %[vector], %[vector], 2 \n\t"
|
|
|
|
|
".set pop \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
: [tmp1] "=&r"(tmp1), [maximum] "+r"(maximum), [value] "=&r"(value)
|
|
|
|
|
: [vector] "r"(vector), [length] "r"(length)
|
|
|
|
|
: "memory");
|
2013-02-21 20:12:21 +00:00
|
|
|
|
|
|
|
|
return maximum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Maximum value of word32 vector. Version for MIPS platform.
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
int32_t WebRtcSpl_MaxValueW32_mips(const int32_t* vector, size_t length) {
|
2013-02-21 20:12:21 +00:00
|
|
|
int32_t maximum = WEBRTC_SPL_WORD32_MIN;
|
|
|
|
|
int tmp1, value;
|
|
|
|
|
|
2016-08-26 04:33:34 -07:00
|
|
|
RTC_DCHECK_GT(length, 0);
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
".set push \n\t"
|
|
|
|
|
".set noreorder \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
"1: \n\t"
|
|
|
|
|
"lw %[value], 0(%[vector]) \n\t"
|
|
|
|
|
"addiu %[length], %[length], -1 \n\t"
|
|
|
|
|
"slt %[tmp1], %[maximum], %[value] \n\t"
|
|
|
|
|
"movn %[maximum], %[value], %[tmp1] \n\t"
|
|
|
|
|
"bgtz %[length], 1b \n\t"
|
|
|
|
|
" addiu %[vector], %[vector], 4 \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
".set pop \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
: [tmp1] "=&r"(tmp1), [maximum] "+r"(maximum), [value] "=&r"(value)
|
|
|
|
|
: [vector] "r"(vector), [length] "r"(length)
|
|
|
|
|
: "memory");
|
2013-02-21 20:12:21 +00:00
|
|
|
|
|
|
|
|
return maximum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Minimum value of word16 vector. Version for MIPS platform.
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
int16_t WebRtcSpl_MinValueW16_mips(const int16_t* vector, size_t length) {
|
2013-02-21 20:12:21 +00:00
|
|
|
int16_t minimum = WEBRTC_SPL_WORD16_MAX;
|
|
|
|
|
int tmp1;
|
|
|
|
|
int16_t value;
|
|
|
|
|
|
2016-08-26 04:33:34 -07:00
|
|
|
RTC_DCHECK_GT(length, 0);
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
".set push \n\t"
|
|
|
|
|
".set noreorder \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
"1: \n\t"
|
|
|
|
|
"lh %[value], 0(%[vector]) \n\t"
|
|
|
|
|
"addiu %[length], %[length], -1 \n\t"
|
|
|
|
|
"slt %[tmp1], %[value], %[minimum] \n\t"
|
|
|
|
|
"movn %[minimum], %[value], %[tmp1] \n\t"
|
|
|
|
|
"bgtz %[length], 1b \n\t"
|
|
|
|
|
" addiu %[vector], %[vector], 2 \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
".set pop \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
: [tmp1] "=&r"(tmp1), [minimum] "+r"(minimum), [value] "=&r"(value)
|
|
|
|
|
: [vector] "r"(vector), [length] "r"(length)
|
|
|
|
|
: "memory");
|
2013-02-21 20:12:21 +00:00
|
|
|
|
|
|
|
|
return minimum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Minimum value of word32 vector. Version for MIPS platform.
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
int32_t WebRtcSpl_MinValueW32_mips(const int32_t* vector, size_t length) {
|
2013-02-21 20:12:21 +00:00
|
|
|
int32_t minimum = WEBRTC_SPL_WORD32_MAX;
|
|
|
|
|
int tmp1, value;
|
|
|
|
|
|
2016-08-26 04:33:34 -07:00
|
|
|
RTC_DCHECK_GT(length, 0);
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
__asm__ volatile(
|
|
|
|
|
".set push \n\t"
|
|
|
|
|
".set noreorder \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
"1: \n\t"
|
|
|
|
|
"lw %[value], 0(%[vector]) \n\t"
|
|
|
|
|
"addiu %[length], %[length], -1 \n\t"
|
|
|
|
|
"slt %[tmp1], %[value], %[minimum] \n\t"
|
|
|
|
|
"movn %[minimum], %[value], %[tmp1] \n\t"
|
|
|
|
|
"bgtz %[length], 1b \n\t"
|
|
|
|
|
" addiu %[vector], %[vector], 4 \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
".set pop \n\t"
|
2013-02-21 20:12:21 +00:00
|
|
|
|
2025-01-09 02:11:09 -08:00
|
|
|
: [tmp1] "=&r"(tmp1), [minimum] "+r"(minimum), [value] "=&r"(value)
|
|
|
|
|
: [vector] "r"(vector), [length] "r"(length)
|
|
|
|
|
: "memory");
|
2013-02-21 20:12:21 +00:00
|
|
|
|
|
|
|
|
return minimum;
|
|
|
|
|
}
|