| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 int16_t WebRtcIlbcfix_EncoderInit(IlbcEncoderInstance* iLBCenc_inst, | 81 int16_t WebRtcIlbcfix_EncoderInit(IlbcEncoderInstance* iLBCenc_inst, |
| 82 int16_t mode) { | 82 int16_t mode) { |
| 83 if ((mode==20)||(mode==30)) { | 83 if ((mode==20)||(mode==30)) { |
| 84 WebRtcIlbcfix_InitEncode((IlbcEncoder*) iLBCenc_inst, mode); | 84 WebRtcIlbcfix_InitEncode((IlbcEncoder*) iLBCenc_inst, mode); |
| 85 return(0); | 85 return(0); |
| 86 } else { | 86 } else { |
| 87 return(-1); | 87 return(-1); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 int WebRtcIlbcfix_Encode(IlbcEncoderInstance* iLBCenc_inst, | 91 int16_t WebRtcIlbcfix_Encode(IlbcEncoderInstance* iLBCenc_inst, |
| 92 const int16_t* speechIn, | 92 const int16_t* speechIn, |
| 93 int16_t len, | 93 int16_t len, |
| 94 uint8_t* encoded) { | 94 uint8_t* encoded) { |
| 95 int16_t pos = 0; | 95 int16_t pos = 0; |
| 96 int16_t encpos = 0; | 96 int16_t encpos = 0; |
| 97 | 97 |
| 98 if ((len != ((IlbcEncoder*)iLBCenc_inst)->blockl) && | 98 if ((len != ((IlbcEncoder*)iLBCenc_inst)->blockl) && |
| 99 #ifdef SPLIT_10MS | 99 #ifdef SPLIT_10MS |
| 100 (len != 80) && | 100 (len != 80) && |
| 101 #endif | 101 #endif |
| 102 (len != 2*((IlbcEncoder*)iLBCenc_inst)->blockl) && | 102 (len != 2*((IlbcEncoder*)iLBCenc_inst)->blockl) && |
| 103 (len != 3*((IlbcEncoder*)iLBCenc_inst)->blockl)) | 103 (len != 3*((IlbcEncoder*)iLBCenc_inst)->blockl)) |
| 104 { | 104 { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 134 int16_t WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance *iLBCdec_inst) { | 134 int16_t WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance *iLBCdec_inst) { |
| 135 WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 20, 1); | 135 WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 20, 1); |
| 136 return(0); | 136 return(0); |
| 137 } | 137 } |
| 138 int16_t WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance *iLBCdec_inst) { | 138 int16_t WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance *iLBCdec_inst) { |
| 139 WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 30, 1); | 139 WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 30, 1); |
| 140 return(0); | 140 return(0); |
| 141 } | 141 } |
| 142 | 142 |
| 143 | 143 |
| 144 int WebRtcIlbcfix_Decode(IlbcDecoderInstance* iLBCdec_inst, | 144 int16_t WebRtcIlbcfix_Decode(IlbcDecoderInstance* iLBCdec_inst, |
| 145 const uint8_t* encoded, | 145 const uint8_t* encoded, |
| 146 int16_t len, | 146 int16_t len, |
| 147 int16_t* decoded, | 147 int16_t* decoded, |
| 148 int16_t* speechType) | 148 int16_t* speechType) |
| 149 { | 149 { |
| 150 int i=0; | 150 int i=0; |
| 151 /* Allow for automatic switching between the frame sizes | 151 /* Allow for automatic switching between the frame sizes |
| 152 (although you do get some discontinuity) */ | 152 (although you do get some discontinuity) */ |
| 153 if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| | 153 if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 154 (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| | 154 (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 155 (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { | 155 (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { |
| 156 /* ok, do nothing */ | 156 /* ok, do nothing */ |
| 157 } else { | 157 } else { |
| 158 /* Test if the mode has changed */ | 158 /* Test if the mode has changed */ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 187 (const uint16_t*)&encoded | 187 (const uint16_t*)&encoded |
| 188 [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], | 188 [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
| 189 (IlbcDecoder*)iLBCdec_inst, 1); | 189 (IlbcDecoder*)iLBCdec_inst, 1); |
| 190 i++; | 190 i++; |
| 191 } | 191 } |
| 192 /* iLBC does not support VAD/CNG yet */ | 192 /* iLBC does not support VAD/CNG yet */ |
| 193 *speechType=1; | 193 *speechType=1; |
| 194 return(i*((IlbcDecoder*)iLBCdec_inst)->blockl); | 194 return(i*((IlbcDecoder*)iLBCdec_inst)->blockl); |
| 195 } | 195 } |
| 196 | 196 |
| 197 int WebRtcIlbcfix_Decode20Ms(IlbcDecoderInstance* iLBCdec_inst, | 197 int16_t WebRtcIlbcfix_Decode20Ms(IlbcDecoderInstance* iLBCdec_inst, |
| 198 const uint8_t* encoded, | 198 const uint8_t* encoded, |
| 199 int16_t len, | 199 int16_t len, |
| 200 int16_t* decoded, | 200 int16_t* decoded, |
| 201 int16_t* speechType) | 201 int16_t* speechType) |
| 202 { | 202 { |
| 203 int i=0; | 203 int i=0; |
| 204 if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| | 204 if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 205 (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| | 205 (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 206 (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { | 206 (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { |
| 207 /* ok, do nothing */ | 207 /* ok, do nothing */ |
| 208 } else { | 208 } else { |
| 209 return(-1); | 209 return(-1); |
| 210 } | 210 } |
| 211 | 211 |
| 212 while ((i*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)<len) { | 212 while ((i*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)<len) { |
| 213 WebRtcIlbcfix_DecodeImpl( | 213 WebRtcIlbcfix_DecodeImpl( |
| 214 &decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], | 214 &decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], |
| 215 (const uint16_t*)&encoded | 215 (const uint16_t*)&encoded |
| 216 [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], | 216 [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
| 217 (IlbcDecoder*)iLBCdec_inst, 1); | 217 (IlbcDecoder*)iLBCdec_inst, 1); |
| 218 i++; | 218 i++; |
| 219 } | 219 } |
| 220 /* iLBC does not support VAD/CNG yet */ | 220 /* iLBC does not support VAD/CNG yet */ |
| 221 *speechType=1; | 221 *speechType=1; |
| 222 return(i*((IlbcDecoder*)iLBCdec_inst)->blockl); | 222 return(i*((IlbcDecoder*)iLBCdec_inst)->blockl); |
| 223 } | 223 } |
| 224 | 224 |
| 225 int WebRtcIlbcfix_Decode30Ms(IlbcDecoderInstance* iLBCdec_inst, | 225 int16_t WebRtcIlbcfix_Decode30Ms(IlbcDecoderInstance* iLBCdec_inst, |
| 226 const uint8_t* encoded, | 226 const uint8_t* encoded, |
| 227 int16_t len, | 227 int16_t len, |
| 228 int16_t* decoded, | 228 int16_t* decoded, |
| 229 int16_t* speechType) | 229 int16_t* speechType) |
| 230 { | 230 { |
| 231 int i=0; | 231 int i=0; |
| 232 if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| | 232 if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 233 (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| | 233 (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 234 (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { | 234 (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { |
| 235 /* ok, do nothing */ | 235 /* ok, do nothing */ |
| 236 } else { | 236 } else { |
| 237 return(-1); | 237 return(-1); |
| 238 } | 238 } |
| 239 | 239 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 WebRtcSpl_MemSetW16(((IlbcDecoder*)iLBCdec_inst)->enh_buf, 0, ENH_BUFL); | 275 WebRtcSpl_MemSetW16(((IlbcDecoder*)iLBCdec_inst)->enh_buf, 0, ENH_BUFL); |
| 276 ((IlbcDecoder*)iLBCdec_inst)->prev_enh_pl = 2; | 276 ((IlbcDecoder*)iLBCdec_inst)->prev_enh_pl = 2; |
| 277 | 277 |
| 278 return (0); | 278 return (0); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void WebRtcIlbcfix_version(char *version) | 281 void WebRtcIlbcfix_version(char *version) |
| 282 { | 282 { |
| 283 strcpy((char*)version, "1.1.1"); | 283 strcpy((char*)version, "1.1.1"); |
| 284 } | 284 } |
| OLD | NEW |