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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 * WebRtcIsacfix_Assign(...) | 65 * WebRtcIsacfix_Assign(...) |
66 * | 66 * |
67 * Functions used when malloc is not allowed | 67 * Functions used when malloc is not allowed |
68 * Place struct at given address | 68 * Place struct at given address |
69 * | 69 * |
70 * If successful, Return 0, else Return -1 | 70 * If successful, Return 0, else Return -1 |
71 */ | 71 */ |
72 | 72 |
73 int16_t WebRtcIsacfix_Assign(ISACFIX_MainStruct **inst, void *ISACFIX_inst_Addr)
{ | 73 int16_t WebRtcIsacfix_Assign(ISACFIX_MainStruct **inst, void *ISACFIX_inst_Addr)
{ |
74 if (ISACFIX_inst_Addr!=NULL) { | 74 if (ISACFIX_inst_Addr!=NULL) { |
75 *inst = (ISACFIX_MainStruct*)ISACFIX_inst_Addr; | 75 ISACFIX_SubStruct* self = ISACFIX_inst_Addr; |
76 (*(ISACFIX_SubStruct**)inst)->errorcode = 0; | 76 *inst = (ISACFIX_MainStruct*)self; |
77 (*(ISACFIX_SubStruct**)inst)->initflag = 0; | 77 self->errorcode = 0; |
78 (*(ISACFIX_SubStruct**)inst)->ISACenc_obj.SaveEnc_ptr = NULL; | 78 self->initflag = 0; |
| 79 self->ISACenc_obj.SaveEnc_ptr = NULL; |
| 80 WebRtcIsacfix_InitBandwidthEstimator(&self->bwestimator_obj); |
79 return(0); | 81 return(0); |
80 } else { | 82 } else { |
81 return(-1); | 83 return(-1); |
82 } | 84 } |
83 } | 85 } |
84 | 86 |
85 | 87 |
86 #ifndef ISACFIX_NO_DYNAMIC_MEM | 88 #ifndef ISACFIX_NO_DYNAMIC_MEM |
87 | 89 |
88 /**************************************************************************** | 90 /**************************************************************************** |
(...skipping 12 matching lines...) Expand all Loading... |
101 int16_t WebRtcIsacfix_Create(ISACFIX_MainStruct **ISAC_main_inst) | 103 int16_t WebRtcIsacfix_Create(ISACFIX_MainStruct **ISAC_main_inst) |
102 { | 104 { |
103 ISACFIX_SubStruct *tempo; | 105 ISACFIX_SubStruct *tempo; |
104 tempo = malloc(1 * sizeof(ISACFIX_SubStruct)); | 106 tempo = malloc(1 * sizeof(ISACFIX_SubStruct)); |
105 *ISAC_main_inst = (ISACFIX_MainStruct *)tempo; | 107 *ISAC_main_inst = (ISACFIX_MainStruct *)tempo; |
106 if (*ISAC_main_inst!=NULL) { | 108 if (*ISAC_main_inst!=NULL) { |
107 (*(ISACFIX_SubStruct**)ISAC_main_inst)->errorcode = 0; | 109 (*(ISACFIX_SubStruct**)ISAC_main_inst)->errorcode = 0; |
108 (*(ISACFIX_SubStruct**)ISAC_main_inst)->initflag = 0; | 110 (*(ISACFIX_SubStruct**)ISAC_main_inst)->initflag = 0; |
109 (*(ISACFIX_SubStruct**)ISAC_main_inst)->ISACenc_obj.SaveEnc_ptr = NULL; | 111 (*(ISACFIX_SubStruct**)ISAC_main_inst)->ISACenc_obj.SaveEnc_ptr = NULL; |
110 WebRtcSpl_Init(); | 112 WebRtcSpl_Init(); |
| 113 WebRtcIsacfix_InitBandwidthEstimator(&tempo->bwestimator_obj); |
111 return(0); | 114 return(0); |
112 } else { | 115 } else { |
113 return(-1); | 116 return(-1); |
114 } | 117 } |
115 } | 118 } |
116 | 119 |
117 | 120 |
118 /**************************************************************************** | 121 /**************************************************************************** |
119 * WebRtcIsacfix_CreateInternal(...) | 122 * WebRtcIsacfix_CreateInternal(...) |
120 * | 123 * |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 statusInit = -1; | 289 statusInit = -1; |
287 } | 290 } |
288 | 291 |
289 ISAC_inst->CodingMode = CodingMode; | 292 ISAC_inst->CodingMode = CodingMode; |
290 | 293 |
291 WebRtcIsacfix_InitMaskingEnc(&ISAC_inst->ISACenc_obj.maskfiltstr_obj); | 294 WebRtcIsacfix_InitMaskingEnc(&ISAC_inst->ISACenc_obj.maskfiltstr_obj); |
292 WebRtcIsacfix_InitPreFilterbank(&ISAC_inst->ISACenc_obj.prefiltbankstr_obj); | 295 WebRtcIsacfix_InitPreFilterbank(&ISAC_inst->ISACenc_obj.prefiltbankstr_obj); |
293 WebRtcIsacfix_InitPitchFilter(&ISAC_inst->ISACenc_obj.pitchfiltstr_obj); | 296 WebRtcIsacfix_InitPitchFilter(&ISAC_inst->ISACenc_obj.pitchfiltstr_obj); |
294 WebRtcIsacfix_InitPitchAnalysis(&ISAC_inst->ISACenc_obj.pitchanalysisstr_obj); | 297 WebRtcIsacfix_InitPitchAnalysis(&ISAC_inst->ISACenc_obj.pitchanalysisstr_obj); |
295 | 298 |
296 | |
297 WebRtcIsacfix_InitBandwidthEstimator(&ISAC_inst->bwestimator_obj); | |
298 WebRtcIsacfix_InitRateModel(&ISAC_inst->ISACenc_obj.rate_data_obj); | 299 WebRtcIsacfix_InitRateModel(&ISAC_inst->ISACenc_obj.rate_data_obj); |
299 | 300 |
300 | 301 |
301 ISAC_inst->ISACenc_obj.buffer_index = 0; | 302 ISAC_inst->ISACenc_obj.buffer_index = 0; |
302 ISAC_inst->ISACenc_obj.frame_nb = 0; | 303 ISAC_inst->ISACenc_obj.frame_nb = 0; |
303 ISAC_inst->ISACenc_obj.BottleNeck = 32000; /* default for I-mode */ | 304 ISAC_inst->ISACenc_obj.BottleNeck = 32000; /* default for I-mode */ |
304 ISAC_inst->ISACenc_obj.MaxDelay = 10; /* default for I-mode */ | 305 ISAC_inst->ISACenc_obj.MaxDelay = 10; /* default for I-mode */ |
305 ISAC_inst->ISACenc_obj.current_framesamples = 0; | 306 ISAC_inst->ISACenc_obj.current_framesamples = 0; |
306 ISAC_inst->ISACenc_obj.s2nr = 0; | 307 ISAC_inst->ISACenc_obj.s2nr = 0; |
307 ISAC_inst->ISACenc_obj.MaxBits = 0; | 308 ISAC_inst->ISACenc_obj.MaxBits = 0; |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 * | 1520 * |
1520 * Output: | 1521 * Output: |
1521 * - version : Pointer to character string | 1522 * - version : Pointer to character string |
1522 * | 1523 * |
1523 */ | 1524 */ |
1524 | 1525 |
1525 void WebRtcIsacfix_version(char *version) | 1526 void WebRtcIsacfix_version(char *version) |
1526 { | 1527 { |
1527 strcpy(version, "3.6.0"); | 1528 strcpy(version, "3.6.0"); |
1528 } | 1529 } |
| 1530 |
| 1531 void WebRtcIsacfix_GetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, |
| 1532 IsacBandwidthInfo* bwinfo) { |
| 1533 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; |
| 1534 assert(inst->initflag & 1); // Decoder initialized. |
| 1535 WebRtcIsacfixBw_GetBandwidthInfo(&inst->bwestimator_obj, bwinfo); |
| 1536 } |
| 1537 |
| 1538 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, |
| 1539 const IsacBandwidthInfo* bwinfo) { |
| 1540 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; |
| 1541 assert(inst->initflag & 2); // Encoder initialized. |
| 1542 WebRtcIsacfixBw_SetBandwidthInfo(&inst->bwestimator_obj, bwinfo); |
| 1543 } |
OLD | NEW |