| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 index = 0; | 363 index = 0; |
| 364 for (i = 1; i < 93; i++) { | 364 for (i = 1; i < 93; i++) { |
| 365 /* Always round downwards. */ | 365 /* Always round downwards. */ |
| 366 if ((inst->enc_Energy - WebRtcCng_kDbov[i]) > 0) { | 366 if ((inst->enc_Energy - WebRtcCng_kDbov[i]) > 0) { |
| 367 index = i; | 367 index = i; |
| 368 break; | 368 break; |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 if ((i == 93) && (index == 0)) | 371 if ((i == 93) && (index == 0)) |
| 372 index = 94; | 372 index = 94; |
| 373 SIDdata[0] = index; | 373 SIDdata[0] = (uint8_t)index; |
| 374 | 374 |
| 375 /* Quantize coefficients with tweak for WebRtc implementation of RFC3389. */ | 375 /* Quantize coefficients with tweak for WebRtc implementation of RFC3389. */ |
| 376 if (inst->enc_nrOfCoefs == WEBRTC_CNG_MAX_LPC_ORDER) { | 376 if (inst->enc_nrOfCoefs == WEBRTC_CNG_MAX_LPC_ORDER) { |
| 377 for (i = 0; i < inst->enc_nrOfCoefs; i++) { | 377 for (i = 0; i < inst->enc_nrOfCoefs; i++) { |
| 378 /* Q15 to Q7 with rounding. */ | 378 /* Q15 to Q7 with rounding. */ |
| 379 SIDdata[i + 1] = ((inst->enc_reflCoefs[i] + 128) >> 8); | 379 SIDdata[i + 1] = ((inst->enc_reflCoefs[i] + 128) >> 8); |
| 380 } | 380 } |
| 381 } else { | 381 } else { |
| 382 for (i = 0; i < inst->enc_nrOfCoefs; i++) { | 382 for (i = 0; i < inst->enc_nrOfCoefs; i++) { |
| 383 /* Q15 to Q7 with rounding. */ | 383 /* Q15 to Q7 with rounding. */ |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 /* Typecast pointer to real structure. */ | 593 /* Typecast pointer to real structure. */ |
| 594 WebRtcCngEncoder* inst = (WebRtcCngEncoder*) cng_inst; | 594 WebRtcCngEncoder* inst = (WebRtcCngEncoder*) cng_inst; |
| 595 return inst->errorcode; | 595 return inst->errorcode; |
| 596 } | 596 } |
| 597 | 597 |
| 598 int16_t WebRtcCng_GetErrorCodeDec(CNG_dec_inst* cng_inst) { | 598 int16_t WebRtcCng_GetErrorCodeDec(CNG_dec_inst* cng_inst) { |
| 599 /* Typecast pointer to real structure. */ | 599 /* Typecast pointer to real structure. */ |
| 600 WebRtcCngDecoder* inst = (WebRtcCngDecoder*) cng_inst; | 600 WebRtcCngDecoder* inst = (WebRtcCngDecoder*) cng_inst; |
| 601 return inst->errorcode; | 601 return inst->errorcode; |
| 602 } | 602 } |
| OLD | NEW |