Reland remaining bits of "Upconvert various types to int."

Most of commit cb180976dd0e9672cde4523d87b5f4857478b5e9 (which reverted
commit 83ad33a8aed1fb00e422b6abd33c3e8942821c24) was already re-landed.  This relands the rest, including modifications by kwiberg to hopefully avoid regressing performance.

In a subsequent change I will see if removing the int16_t cast in this modified version still causes perf problems.

BUG=499241
TEST=none
TBR=andrew

Review URL: https://codereview.webrtc.org/1181693005

Cr-Commit-Position: refs/heads/master@{#9487}
This commit is contained in:
pkasting 2015-06-22 19:33:49 -07:00 committed by Commit bot
parent db4fecfb01
commit 72cfd6c468
4 changed files with 19 additions and 17 deletions

View File

@ -16,16 +16,18 @@ void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int16_t right_shifts,
int16_t step_seq2) {
int right_shifts,
int step_seq2) {
int i = 0, j = 0;
for (i = 0; i < dim_cross_correlation; i++) {
*cross_correlation = 0;
int32_t corr = 0;
/* Unrolling doesn't seem to improve performance. */
for (j = 0; j < dim_seq; j++) {
*cross_correlation += (seq1[j] * seq2[step_seq2 * i + j]) >> right_shifts;
// It's not clear why casting |right_shifts| here helps performance.
corr += (seq1[j] * seq2[j]) >> (int16_t)right_shifts;
}
cross_correlation++;
seq2 += step_seq2;
*cross_correlation++ = corr;
}
}

View File

@ -15,8 +15,8 @@ void WebRtcSpl_CrossCorrelation_mips(int32_t* cross_correlation,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int16_t right_shifts,
int16_t step_seq2) {
int right_shifts,
int step_seq2) {
int32_t t0 = 0, t1 = 0, t2 = 0, t3 = 0, sum = 0;
int16_t *pseq2 = NULL;

View File

@ -74,8 +74,8 @@ void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int16_t right_shifts,
int16_t step_seq2) {
int right_shifts,
int step_seq2) {
int i = 0;
for (i = 0; i < dim_cross_correlation; i++) {

View File

@ -542,24 +542,24 @@ typedef void (*CrossCorrelation)(int32_t* cross_correlation,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int16_t right_shifts,
int16_t step_seq2);
int right_shifts,
int step_seq2);
extern CrossCorrelation WebRtcSpl_CrossCorrelation;
void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation,
const int16_t* seq1,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int16_t right_shifts,
int16_t step_seq2);
int right_shifts,
int step_seq2);
#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation,
const int16_t* seq1,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int16_t right_shifts,
int16_t step_seq2);
int right_shifts,
int step_seq2);
#endif
#if defined(MIPS32_LE)
void WebRtcSpl_CrossCorrelation_mips(int32_t* cross_correlation,
@ -567,8 +567,8 @@ void WebRtcSpl_CrossCorrelation_mips(int32_t* cross_correlation,
const int16_t* seq2,
int16_t dim_seq,
int16_t dim_cross_correlation,
int16_t right_shifts,
int16_t step_seq2);
int right_shifts,
int step_seq2);
#endif
// Creates (the first half of) a Hanning window. Size must be at least 1 and