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 |
11 /* | 11 /* |
12 * isacfix.c | 12 * isacfix.c |
13 * | 13 * |
14 * This C file contains the functions for the ISAC API | 14 * This C file contains the functions for the ISAC API |
15 * | 15 * |
16 */ | 16 */ |
17 | 17 |
18 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/isacfix.h" | 18 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/isacfix.h" |
19 | 19 |
20 #include <assert.h> | |
21 #include <stdlib.h> | 20 #include <stdlib.h> |
22 | 21 |
| 22 #include "webrtc/base/checks.h" |
23 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator
.h" | 23 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator
.h" |
24 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h" | 24 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h" |
25 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h" | 25 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h" |
26 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal
.h" | 26 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal
.h" |
27 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h
" | 27 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h
" |
28 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/structs.h" | 28 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/structs.h" |
29 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" | 29 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" |
30 | 30 |
31 // Declare function pointers. | 31 // Declare function pointers. |
32 FilterMaLoopFix WebRtcIsacfix_FilterMaLoopFix; | 32 FilterMaLoopFix WebRtcIsacfix_FilterMaLoopFix; |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 ISAC_inst->errorcode = ISAC_DISALLOWED_FRAME_LENGTH; | 1106 ISAC_inst->errorcode = ISAC_DISALLOWED_FRAME_LENGTH; |
1107 return -1; | 1107 return -1; |
1108 } | 1108 } |
1109 | 1109 |
1110 return 0; | 1110 return 0; |
1111 } | 1111 } |
1112 | 1112 |
1113 void WebRtcIsacfix_SetInitialBweBottleneck(ISACFIX_MainStruct* ISAC_main_inst, | 1113 void WebRtcIsacfix_SetInitialBweBottleneck(ISACFIX_MainStruct* ISAC_main_inst, |
1114 int bottleneck_bits_per_second) { | 1114 int bottleneck_bits_per_second) { |
1115 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; | 1115 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; |
1116 assert(bottleneck_bits_per_second >= 10000 && | 1116 RTC_DCHECK_GE(bottleneck_bits_per_second, 10000); |
1117 bottleneck_bits_per_second <= 32000); | 1117 RTC_DCHECK_LE(bottleneck_bits_per_second, 32000); |
1118 inst->bwestimator_obj.sendBwAvg = ((uint32_t)bottleneck_bits_per_second) << 7; | 1118 inst->bwestimator_obj.sendBwAvg = ((uint32_t)bottleneck_bits_per_second) << 7; |
1119 } | 1119 } |
1120 | 1120 |
1121 /**************************************************************************** | 1121 /**************************************************************************** |
1122 * WebRtcIsacfix_ControlBwe(...) | 1122 * WebRtcIsacfix_ControlBwe(...) |
1123 * | 1123 * |
1124 * This function sets the initial values of bottleneck and frame-size if | 1124 * This function sets the initial values of bottleneck and frame-size if |
1125 * iSAC is used in channel-adaptive mode. Through this API, users can | 1125 * iSAC is used in channel-adaptive mode. Through this API, users can |
1126 * enforce a frame-size for all values of bottleneck. Then iSAC will not | 1126 * enforce a frame-size for all values of bottleneck. Then iSAC will not |
1127 * automatically change the frame-size. | 1127 * automatically change the frame-size. |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 */ | 1532 */ |
1533 | 1533 |
1534 void WebRtcIsacfix_version(char *version) | 1534 void WebRtcIsacfix_version(char *version) |
1535 { | 1535 { |
1536 strcpy(version, "3.6.0"); | 1536 strcpy(version, "3.6.0"); |
1537 } | 1537 } |
1538 | 1538 |
1539 void WebRtcIsacfix_GetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, | 1539 void WebRtcIsacfix_GetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, |
1540 IsacBandwidthInfo* bwinfo) { | 1540 IsacBandwidthInfo* bwinfo) { |
1541 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; | 1541 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; |
1542 assert(inst->initflag & 1); // Decoder initialized. | 1542 RTC_DCHECK_NE(0, inst->initflag & 1); // Decoder initialized. |
1543 WebRtcIsacfixBw_GetBandwidthInfo(&inst->bwestimator_obj, bwinfo); | 1543 WebRtcIsacfixBw_GetBandwidthInfo(&inst->bwestimator_obj, bwinfo); |
1544 } | 1544 } |
1545 | 1545 |
1546 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, | 1546 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, |
1547 const IsacBandwidthInfo* bwinfo) { | 1547 const IsacBandwidthInfo* bwinfo) { |
1548 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; | 1548 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; |
1549 assert(inst->initflag & 2); // Encoder initialized. | 1549 RTC_DCHECK_NE(0, inst->initflag & 2); // Encoder initialized. |
1550 WebRtcIsacfixBw_SetBandwidthInfo(&inst->bwestimator_obj, bwinfo); | 1550 WebRtcIsacfixBw_SetBandwidthInfo(&inst->bwestimator_obj, bwinfo); |
1551 } | 1551 } |
OLD | NEW |