| OLD | NEW |
| 1 /* Copyright (c) 2007-2008 CSIRO | 1 /* Copyright (c) 2007-2008 CSIRO |
| 2 Copyright (c) 2007-2009 Xiph.Org Foundation | 2 Copyright (c) 2007-2009 Xiph.Org Foundation |
| 3 Written by Jean-Marc Valin */ | 3 Written by Jean-Marc Valin */ |
| 4 /** | 4 /** |
| 5 @file pitch.c | 5 @file pitch.c |
| 6 @brief Pitch analysis | 6 @brief Pitch analysis |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 /* | 9 /* |
| 10 Redistribution and use in source and binary forms, with or without | 10 Redistribution and use in source and binary forms, with or without |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 for (i=0;i<max_pitch;i++) | 70 for (i=0;i<max_pitch;i++) |
| 71 { | 71 { |
| 72 if (xcorr[i]>0) | 72 if (xcorr[i]>0) |
| 73 { | 73 { |
| 74 opus_val16 num; | 74 opus_val16 num; |
| 75 opus_val32 xcorr16; | 75 opus_val32 xcorr16; |
| 76 xcorr16 = EXTRACT16(VSHR32(xcorr[i], xshift)); | 76 xcorr16 = EXTRACT16(VSHR32(xcorr[i], xshift)); |
| 77 #ifndef FIXED_POINT | 77 #ifndef FIXED_POINT |
| 78 /* Considering the range of xcorr16, this should avoid both underflows | 78 /* Considering the range of xcorr16, this should avoid both underflows |
| 79 and overflows (inf) when squaring xcorr16 */ | 79 and overflows (inf) when squaring xcorr16 */ |
| 80 xcorr16 *= 1e-12; | 80 xcorr16 *= 1e-12f; |
| 81 #endif | 81 #endif |
| 82 num = MULT16_16_Q15(xcorr16,xcorr16); | 82 num = MULT16_16_Q15(xcorr16,xcorr16); |
| 83 if (MULT16_32_Q15(num,best_den[1]) > MULT16_32_Q15(best_num[1],Syy)) | 83 if (MULT16_32_Q15(num,best_den[1]) > MULT16_32_Q15(best_num[1],Syy)) |
| 84 { | 84 { |
| 85 if (MULT16_32_Q15(num,best_den[0]) > MULT16_32_Q15(best_num[0],Syy)) | 85 if (MULT16_32_Q15(num,best_den[0]) > MULT16_32_Q15(best_num[0],Syy)) |
| 86 { | 86 { |
| 87 best_num[1] = best_num[0]; | 87 best_num[1] = best_num[0]; |
| 88 best_den[1] = best_den[0]; | 88 best_den[1] = best_den[0]; |
| 89 best_pitch[1] = best_pitch[0]; | 89 best_pitch[1] = best_pitch[0]; |
| 90 best_num[0] = num; | 90 best_num[0] = num; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 else | 401 else |
| 402 offset = 0; | 402 offset = 0; |
| 403 if (pg > g) | 403 if (pg > g) |
| 404 pg = g; | 404 pg = g; |
| 405 *T0_ = 2*T+offset; | 405 *T0_ = 2*T+offset; |
| 406 | 406 |
| 407 if (*T0_<minperiod0) | 407 if (*T0_<minperiod0) |
| 408 *T0_=minperiod0; | 408 *T0_=minperiod0; |
| 409 return pg; | 409 return pg; |
| 410 } | 410 } |
| OLD | NEW |