| OLD | NEW |
| 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 |
| 11 /****************************************************************** | 11 /****************************************************************** |
| 12 | 12 |
| 13 iLBC Speech Coder ANSI-C Source Code | 13 iLBC Speech Coder ANSI-C Source Code |
| 14 | 14 |
| 15 WebRtcIlbcfix_FrameClassify.c | 15 WebRtcIlbcfix_FrameClassify.c |
| 16 | 16 |
| 17 ******************************************************************/ | 17 ******************************************************************/ |
| 18 | 18 |
| 19 #include "defines.h" | 19 #include "defines.h" |
| 20 #include "constants.h" | 20 #include "constants.h" |
| 21 | 21 |
| 22 /*----------------------------------------------------------------* | 22 /*----------------------------------------------------------------* |
| 23 * Classification of subframes to localize start state | 23 * Classification of subframes to localize start state |
| 24 *---------------------------------------------------------------*/ | 24 *---------------------------------------------------------------*/ |
| 25 | 25 |
| 26 int16_t WebRtcIlbcfix_FrameClassify( | 26 size_t WebRtcIlbcfix_FrameClassify( |
| 27 /* (o) Index to the max-energy sub frame */ | 27 /* (o) Index to the max-energy sub frame */ |
| 28 IlbcEncoder *iLBCenc_inst, | 28 IlbcEncoder *iLBCenc_inst, |
| 29 /* (i/o) the encoder state structure */ | 29 /* (i/o) the encoder state structure */ |
| 30 int16_t *residualFIX /* (i) lpc residual signal */ | 30 int16_t *residualFIX /* (i) lpc residual signal */ |
| 31 ){ | 31 ){ |
| 32 int16_t max, scale; | 32 int16_t max, scale; |
| 33 int32_t ssqEn[NSUB_MAX-1]; | 33 int32_t ssqEn[NSUB_MAX-1]; |
| 34 int16_t *ssqPtr; | 34 int16_t *ssqPtr; |
| 35 int32_t *seqEnPtr; | 35 int32_t *seqEnPtr; |
| 36 int32_t maxW32; | 36 int32_t maxW32; |
| 37 int16_t scale1; | 37 int16_t scale1; |
| 38 int16_t pos; | 38 size_t pos; |
| 39 int n; | 39 size_t n; |
| 40 | 40 |
| 41 /* | 41 /* |
| 42 Calculate the energy of each of the 80 sample blocks | 42 Calculate the energy of each of the 80 sample blocks |
| 43 in the draft the 4 first and last samples are windowed with 1/5...4/5 | 43 in the draft the 4 first and last samples are windowed with 1/5...4/5 |
| 44 and 4/5...1/5 respectively. To simplify for the fixpoint we have changed | 44 and 4/5...1/5 respectively. To simplify for the fixpoint we have changed |
| 45 this to 0 0 1 1 and 1 1 0 0 | 45 this to 0 0 1 1 and 1 1 0 0 |
| 46 */ | 46 */ |
| 47 | 47 |
| 48 max = WebRtcSpl_MaxAbsValueW16(residualFIX, iLBCenc_inst->blockl); | 48 max = WebRtcSpl_MaxAbsValueW16(residualFIX, iLBCenc_inst->blockl); |
| 49 scale = WebRtcSpl_GetSizeInBits((uint32_t)(max * max)); | 49 scale = WebRtcSpl_GetSizeInBits((uint32_t)(max * max)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 75 } else { | 75 } else { |
| 76 ssqPtr=(int16_t*)WebRtcIlbcfix_kStartSequenceEnrgWin; | 76 ssqPtr=(int16_t*)WebRtcIlbcfix_kStartSequenceEnrgWin; |
| 77 } | 77 } |
| 78 for (n=(iLBCenc_inst->nsub-1); n>0; n--) { | 78 for (n=(iLBCenc_inst->nsub-1); n>0; n--) { |
| 79 (*seqEnPtr)=WEBRTC_SPL_MUL(((*seqEnPtr)>>scale1), (*ssqPtr)); | 79 (*seqEnPtr)=WEBRTC_SPL_MUL(((*seqEnPtr)>>scale1), (*ssqPtr)); |
| 80 seqEnPtr++; | 80 seqEnPtr++; |
| 81 ssqPtr++; | 81 ssqPtr++; |
| 82 } | 82 } |
| 83 | 83 |
| 84 /* Extract the best choise of start state */ | 84 /* Extract the best choise of start state */ |
| 85 pos = WebRtcSpl_MaxIndexW32(ssqEn, iLBCenc_inst->nsub - 1) + 1; | 85 pos = (size_t)WebRtcSpl_MaxIndexW32(ssqEn, iLBCenc_inst->nsub - 1) + 1; |
| 86 | 86 |
| 87 return(pos); | 87 return(pos); |
| 88 } | 88 } |
| OLD | NEW |