- Timestamp:
- Feb 28, 2008 4:28:41 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/wsola.c
r1824 r1826 25 25 #define THIS_FILE "wsola.c" 26 26 27 //#undef PJ_HAS_FLOATING_POINT 27 28 28 29 /* History size, in percentage of samples_per_frame */ … … 92 93 unsigned i; 93 94 94 for (i=0; i<template_cnt; ++i) { 95 for (i=0; i<template_cnt; i += 8) { 96 corr += ((float)frm[i+0]) * ((float)sr[i+0]) + 97 ((float)frm[i+1]) * ((float)sr[i+1]) + 98 ((float)frm[i+2]) * ((float)sr[i+2]) + 99 ((float)frm[i+3]) * ((float)sr[i+3]) + 100 ((float)frm[i+4]) * ((float)sr[i+4]) + 101 ((float)frm[i+5]) * ((float)sr[i+5]) + 102 ((float)frm[i+6]) * ((float)sr[i+6]) + 103 ((float)frm[i+7]) * ((float)sr[i+7]); 104 } 105 for (; i<template_cnt; ++i) { 95 106 corr += ((float)frm[i]) * ((float)sr[i]); 96 107 } … … 161 172 pj_int64_t best_corr = 0; 162 173 174 163 175 for (sr=beg; sr!=end; ++sr) { 164 176 pj_int64_t corr = 0; 165 177 unsigned i; 166 178 167 for (i=0; i<template_cnt; ++i) { 179 for (i=0; i<template_cnt; i+=8) { 180 corr += ((int)frm[i+0]) * ((int)sr[i+0]) + 181 ((int)frm[i+1]) * ((int)sr[i+1]) + 182 ((int)frm[i+2]) * ((int)sr[i+2]) + 183 ((int)frm[i+3]) * ((int)sr[i+3]) + 184 ((int)frm[i+4]) * ((int)sr[i+4]) + 185 ((int)frm[i+5]) * ((int)sr[i+5]) + 186 ((int)frm[i+6]) * ((int)sr[i+6]) + 187 ((int)frm[i+7]) * ((int)sr[i+7]); 188 } 189 for (; i<template_cnt; ++i) { 168 190 corr += ((int)frm[i]) * ((int)sr[i]); 169 191 } … … 193 215 194 216 for (i=0; i<count; ++i) { 195 int val; 196 val = ((int)(l[i]) * (int)(w[count-1-i]) + 197 (int)(r[i]) * (int)(w[i])); 198 dst[i] = (short)(val >> WINDOW_BITS); 199 200 assert((val>=0 && dst[i]>=0) || 201 (val<0 && dst[i]<0)); 217 dst[i] = (short)(((int)(l[i]) * (int)(w[count-1-i]) + 218 (int)(r[i]) * (int)(w[i])) >> WINDOW_BITS); 202 219 } 203 220 } … … 211 228 212 229 for (i=0; i<count; ++i) { 213 int val; 214 215 assert(stepdown >= 0); 216 217 val = (l[i] * stepdown + r[i] * (1-stepdown)); 218 dst[i] = (short)(val >> WINDOW_BITS); 230 dst[i]=(short)((l[i] * stepdown + r[i] * (1-stepdown)) >> WINDOW_BITS); 219 231 stepdown -= step; 220 221 assert((val>=0 && dst[i]>=0) ||222 (val<0 && dst[i]<0));223 232 } 224 233 }
Note: See TracChangeset
for help on using the changeset viewer.