Index: webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c |
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c b/webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c |
index b6cc2406831952e7395b1cdb8d102318a2963da9..f308d30fb52839b1744e6848daf51034d3da1fb5 100644 |
--- a/webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c |
+++ b/webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c |
@@ -25,22 +25,23 @@ |
*---------------------------------------------------------------*/ |
void WebRtcIlbcfix_NearestNeighbor( |
- int16_t *index, /* (o) index of array element closest to value */ |
- int16_t *array, /* (i) data array (Q2) */ |
- int16_t value, /* (i) value (Q2) */ |
+ size_t *index, /* (o) index of array element closest to value */ |
+ const size_t *array, /* (i) data array (Q2) */ |
+ size_t value, /* (i) value (Q2) */ |
size_t arlength /* (i) dimension of data array (==8) */ |
){ |
size_t i; |
- int16_t diff; |
+ int32_t signed_value = (int32_t)value; |
+ int32_t diff; |
/* Stack based */ |
int32_t crit[8]; |
/* Calculate square distance */ |
- for(i=0;i<arlength;i++){ |
- diff=array[i]-value; |
+ for (i = 0; i < arlength; i++) { |
+ diff = (int32_t)array[i] - signed_value; |
crit[i] = diff * diff; |
} |
/* Find the minimum square distance */ |
- *index=WebRtcSpl_MinIndexW32(crit, arlength); |
+ *index = WebRtcSpl_MinIndexW32(crit, arlength); |
} |