Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: webrtc/modules/audio_coding/codecs/ilbc/enhancer_interface.c

Issue 1184643002: Reland "Upconvert various types to int.", ilbc portion. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 /* references */ 112 /* references */
113 target = downsampled + 60 + iblock * ENH_BLOCKL_HALF; 113 target = downsampled + 60 + iblock * ENH_BLOCKL_HALF;
114 regressor = target - 10; 114 regressor = target - 10;
115 115
116 /* scaling */ 116 /* scaling */
117 max16 = WebRtcSpl_MaxAbsValueW16(&regressor[-50], ENH_BLOCKL_HALF + 50 - 1); 117 max16 = WebRtcSpl_MaxAbsValueW16(&regressor[-50], ENH_BLOCKL_HALF + 50 - 1);
118 shifts = WebRtcSpl_GetSizeInBits((uint32_t)(max16 * max16)) - 25; 118 shifts = WebRtcSpl_GetSizeInBits((uint32_t)(max16 * max16)) - 25;
119 shifts = WEBRTC_SPL_MAX(0, shifts); 119 shifts = WEBRTC_SPL_MAX(0, shifts);
120 120
121 /* compute cross correlation */ 121 /* compute cross correlation */
122 WebRtcSpl_CrossCorrelation(corr32, target, regressor, 122 WebRtcSpl_CrossCorrelation(corr32, target, regressor, ENH_BLOCKL_HALF, 50,
123 ENH_BLOCKL_HALF, 50, (int16_t)shifts, -1); 123 shifts, -1);
124 124
125 /* Find 3 highest correlations that should be compared for the 125 /* Find 3 highest correlations that should be compared for the
126 highest (corr*corr)/ener */ 126 highest (corr*corr)/ener */
127 127
128 for (i=0;i<2;i++) { 128 for (i=0;i<2;i++) {
129 lagmax[i] = WebRtcSpl_MaxIndexW32(corr32, 50); 129 lagmax[i] = WebRtcSpl_MaxIndexW32(corr32, 50);
130 corrmax[i] = corr32[lagmax[i]]; 130 corrmax[i] = corr32[lagmax[i]];
131 start = lagmax[i] - 2; 131 start = lagmax[i] - 2;
132 stop = lagmax[i] + 2; 132 stop = lagmax[i] + 2;
133 start = WEBRTC_SPL_MAX(0, start); 133 start = WEBRTC_SPL_MAX(0, start);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 regressor=in+tlag-1; 198 regressor=in+tlag-1;
199 199
200 /* scaling */ 200 /* scaling */
201 max16 = WebRtcSpl_MaxAbsValueW16(regressor, plc_blockl + 3 - 1); 201 max16 = WebRtcSpl_MaxAbsValueW16(regressor, plc_blockl + 3 - 1);
202 if (max16>5000) 202 if (max16>5000)
203 shifts=2; 203 shifts=2;
204 else 204 else
205 shifts=0; 205 shifts=0;
206 206
207 /* compute cross correlation */ 207 /* compute cross correlation */
208 WebRtcSpl_CrossCorrelation(corr32, target, regressor, 208 WebRtcSpl_CrossCorrelation(corr32, target, regressor, plc_blockl, 3, shifts,
209 plc_blockl, 3, (int16_t)shifts, 1); 209 1);
210 210
211 /* find lag */ 211 /* find lag */
212 lag=WebRtcSpl_MaxIndexW32(corr32, 3); 212 lag=WebRtcSpl_MaxIndexW32(corr32, 3);
213 lag+=tlag-1; 213 lag+=tlag-1;
214 214
215 /* Copy the backward PLC to plc_pred */ 215 /* Copy the backward PLC to plc_pred */
216 216
217 if (iLBCdec_inst->prev_enh_pl==1) { 217 if (iLBCdec_inst->prev_enh_pl==1) {
218 if (lag>plc_blockl) { 218 if (lag>plc_blockl) {
219 WEBRTC_SPL_MEMCPY_W16(plc_pred, &in[lag-plc_blockl], plc_blockl); 219 WEBRTC_SPL_MEMCPY_W16(plc_pred, &in[lag-plc_blockl], plc_blockl);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 WebRtcIlbcfix_Enhancer(out + iblock * ENH_BLOCKL, 365 WebRtcIlbcfix_Enhancer(out + iblock * ENH_BLOCKL,
366 enh_buf, 366 enh_buf,
367 ENH_BUFL, 367 ENH_BUFL,
368 (int16_t)(iblock * ENH_BLOCKL + startPos), 368 (int16_t)(iblock * ENH_BLOCKL + startPos),
369 enh_period, 369 enh_period,
370 (int16_t*)WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT); 370 (int16_t*)WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT);
371 } 371 }
372 372
373 return (lag); 373 return (lag);
374 } 374 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/ilbc/cb_search.c ('k') | webrtc/modules/audio_coding/codecs/ilbc/ilbc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698