niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
leozwang@webrtc.org | 91b359e | 2012-02-28 17:26:14 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | /****************************************************************** |
| 12 | |
| 13 | iLBC Speech Coder ANSI-C Source Code |
| 14 | |
| 15 | iLBCInterface.c |
| 16 | |
| 17 | ******************************************************************/ |
| 18 | |
| 19 | #include "ilbc.h" |
| 20 | #include "defines.h" |
| 21 | #include "init_encode.h" |
| 22 | #include "encode.h" |
| 23 | #include "init_decode.h" |
| 24 | #include "decode.h" |
| 25 | #include <stdlib.h> |
| 26 | |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 27 | int16_t WebRtcIlbcfix_EncoderAssign(IlbcEncoderInstance** iLBC_encinst, |
| 28 | int16_t* ILBCENC_inst_Addr, |
| 29 | int16_t* size) { |
| 30 | *iLBC_encinst=(IlbcEncoderInstance*)ILBCENC_inst_Addr; |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 31 | *size=sizeof(IlbcEncoder)/sizeof(int16_t); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | if (*iLBC_encinst!=NULL) { |
| 33 | return(0); |
| 34 | } else { |
| 35 | return(-1); |
| 36 | } |
| 37 | } |
| 38 | |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 39 | int16_t WebRtcIlbcfix_DecoderAssign(IlbcDecoderInstance** iLBC_decinst, |
| 40 | int16_t* ILBCDEC_inst_Addr, |
| 41 | int16_t* size) { |
| 42 | *iLBC_decinst=(IlbcDecoderInstance*)ILBCDEC_inst_Addr; |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 43 | *size=sizeof(IlbcDecoder)/sizeof(int16_t); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | if (*iLBC_decinst!=NULL) { |
| 45 | return(0); |
| 46 | } else { |
| 47 | return(-1); |
| 48 | } |
| 49 | } |
| 50 | |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 51 | int16_t WebRtcIlbcfix_EncoderCreate(IlbcEncoderInstance **iLBC_encinst) { |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 52 | *iLBC_encinst=(IlbcEncoderInstance*)malloc(sizeof(IlbcEncoder)); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 53 | if (*iLBC_encinst!=NULL) { |
kma@webrtc.org | ac4d70d | 2012-10-05 00:19:01 +0000 | [diff] [blame] | 54 | WebRtcSpl_Init(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 55 | return(0); |
| 56 | } else { |
| 57 | return(-1); |
| 58 | } |
| 59 | } |
| 60 | |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 61 | int16_t WebRtcIlbcfix_DecoderCreate(IlbcDecoderInstance **iLBC_decinst) { |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 62 | *iLBC_decinst=(IlbcDecoderInstance*)malloc(sizeof(IlbcDecoder)); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 63 | if (*iLBC_decinst!=NULL) { |
kma@webrtc.org | ac4d70d | 2012-10-05 00:19:01 +0000 | [diff] [blame] | 64 | WebRtcSpl_Init(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 65 | return(0); |
| 66 | } else { |
| 67 | return(-1); |
| 68 | } |
| 69 | } |
| 70 | |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 71 | int16_t WebRtcIlbcfix_EncoderFree(IlbcEncoderInstance *iLBC_encinst) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 72 | free(iLBC_encinst); |
| 73 | return(0); |
| 74 | } |
| 75 | |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 76 | int16_t WebRtcIlbcfix_DecoderFree(IlbcDecoderInstance *iLBC_decinst) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 77 | free(iLBC_decinst); |
| 78 | return(0); |
| 79 | } |
| 80 | |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 81 | int16_t WebRtcIlbcfix_EncoderInit(IlbcEncoderInstance* iLBCenc_inst, |
| 82 | int16_t mode) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 83 | if ((mode==20)||(mode==30)) { |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 84 | WebRtcIlbcfix_InitEncode((IlbcEncoder*) iLBCenc_inst, mode); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 85 | return(0); |
| 86 | } else { |
| 87 | return(-1); |
| 88 | } |
| 89 | } |
| 90 | |
Peter Kasting | a8b335c | 2015-06-11 18:51:20 -0700 | [diff] [blame] | 91 | int WebRtcIlbcfix_Encode(IlbcEncoderInstance* iLBCenc_inst, |
| 92 | const int16_t* speechIn, |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 93 | size_t len, |
Peter Kasting | a8b335c | 2015-06-11 18:51:20 -0700 | [diff] [blame] | 94 | uint8_t* encoded) { |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 95 | size_t pos = 0; |
| 96 | size_t encpos = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 97 | |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 98 | if ((len != ((IlbcEncoder*)iLBCenc_inst)->blockl) && |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 99 | #ifdef SPLIT_10MS |
| 100 | (len != 80) && |
| 101 | #endif |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 102 | (len != 2*((IlbcEncoder*)iLBCenc_inst)->blockl) && |
| 103 | (len != 3*((IlbcEncoder*)iLBCenc_inst)->blockl)) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 104 | { |
| 105 | /* A maximum of 3 frames/packet is allowed */ |
| 106 | return(-1); |
| 107 | } else { |
| 108 | |
| 109 | /* call encoder */ |
| 110 | while (pos<len) { |
kwiberg@webrtc.org | cb858ba | 2014-12-08 17:11:44 +0000 | [diff] [blame] | 111 | WebRtcIlbcfix_EncodeImpl((uint16_t*)&encoded[2 * encpos], &speechIn[pos], |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 112 | (IlbcEncoder*)iLBCenc_inst); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 113 | #ifdef SPLIT_10MS |
| 114 | pos += 80; |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 115 | if(((IlbcEncoder*)iLBCenc_inst)->section == 0) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 116 | #else |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 117 | pos += ((IlbcEncoder*)iLBCenc_inst)->blockl; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 118 | #endif |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 119 | encpos += ((IlbcEncoder*)iLBCenc_inst)->no_of_words; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 120 | } |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 121 | return (int)(encpos*2); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 122 | } |
| 123 | } |
| 124 | |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 125 | int16_t WebRtcIlbcfix_DecoderInit(IlbcDecoderInstance* iLBCdec_inst, |
| 126 | int16_t mode) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 127 | if ((mode==20)||(mode==30)) { |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 128 | WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, mode, 1); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 129 | return(0); |
| 130 | } else { |
| 131 | return(-1); |
| 132 | } |
| 133 | } |
Karl Wiberg | 4376648 | 2015-08-27 15:22:11 +0200 | [diff] [blame^] | 134 | void WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance* iLBCdec_inst) { |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 135 | WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 20, 1); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 136 | } |
Karl Wiberg | 4376648 | 2015-08-27 15:22:11 +0200 | [diff] [blame^] | 137 | void WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance* iLBCdec_inst) { |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 138 | WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 30, 1); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | |
Peter Kasting | a8b335c | 2015-06-11 18:51:20 -0700 | [diff] [blame] | 142 | int WebRtcIlbcfix_Decode(IlbcDecoderInstance* iLBCdec_inst, |
| 143 | const uint8_t* encoded, |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 144 | size_t len, |
Peter Kasting | a8b335c | 2015-06-11 18:51:20 -0700 | [diff] [blame] | 145 | int16_t* decoded, |
| 146 | int16_t* speechType) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 147 | { |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 148 | size_t i=0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 149 | /* Allow for automatic switching between the frame sizes |
| 150 | (although you do get some discontinuity) */ |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 151 | if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 152 | (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 153 | (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 154 | /* ok, do nothing */ |
| 155 | } else { |
| 156 | /* Test if the mode has changed */ |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 157 | if (((IlbcDecoder*)iLBCdec_inst)->mode==20) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 158 | if ((len==NO_OF_BYTES_30MS)|| |
| 159 | (len==2*NO_OF_BYTES_30MS)|| |
| 160 | (len==3*NO_OF_BYTES_30MS)) { |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 161 | WebRtcIlbcfix_InitDecode( |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 162 | ((IlbcDecoder*)iLBCdec_inst), 30, |
| 163 | ((IlbcDecoder*)iLBCdec_inst)->use_enhancer); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 164 | } else { |
| 165 | /* Unsupported frame length */ |
| 166 | return(-1); |
| 167 | } |
| 168 | } else { |
| 169 | if ((len==NO_OF_BYTES_20MS)|| |
| 170 | (len==2*NO_OF_BYTES_20MS)|| |
| 171 | (len==3*NO_OF_BYTES_20MS)) { |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 172 | WebRtcIlbcfix_InitDecode( |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 173 | ((IlbcDecoder*)iLBCdec_inst), 20, |
| 174 | ((IlbcDecoder*)iLBCdec_inst)->use_enhancer); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 175 | } else { |
| 176 | /* Unsupported frame length */ |
| 177 | return(-1); |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 182 | while ((i*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)<len) { |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 183 | WebRtcIlbcfix_DecodeImpl( |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 184 | &decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 185 | (const uint16_t*)&encoded |
jmarusic@webrtc.org | 71b35a4 | 2015-02-17 16:02:18 +0000 | [diff] [blame] | 186 | [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 187 | (IlbcDecoder*)iLBCdec_inst, 1); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 188 | i++; |
| 189 | } |
| 190 | /* iLBC does not support VAD/CNG yet */ |
| 191 | *speechType=1; |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 192 | return (int)(i*((IlbcDecoder*)iLBCdec_inst)->blockl); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 193 | } |
| 194 | |
Peter Kasting | a8b335c | 2015-06-11 18:51:20 -0700 | [diff] [blame] | 195 | int WebRtcIlbcfix_Decode20Ms(IlbcDecoderInstance* iLBCdec_inst, |
| 196 | const uint8_t* encoded, |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 197 | size_t len, |
Peter Kasting | a8b335c | 2015-06-11 18:51:20 -0700 | [diff] [blame] | 198 | int16_t* decoded, |
| 199 | int16_t* speechType) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 200 | { |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 201 | size_t i=0; |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 202 | if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 203 | (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 204 | (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 205 | /* ok, do nothing */ |
| 206 | } else { |
| 207 | return(-1); |
| 208 | } |
| 209 | |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 210 | while ((i*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)<len) { |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 211 | WebRtcIlbcfix_DecodeImpl( |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 212 | &decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 213 | (const uint16_t*)&encoded |
jmarusic@webrtc.org | 71b35a4 | 2015-02-17 16:02:18 +0000 | [diff] [blame] | 214 | [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 215 | (IlbcDecoder*)iLBCdec_inst, 1); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 216 | i++; |
| 217 | } |
| 218 | /* iLBC does not support VAD/CNG yet */ |
| 219 | *speechType=1; |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 220 | return (int)(i*((IlbcDecoder*)iLBCdec_inst)->blockl); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 221 | } |
| 222 | |
Peter Kasting | a8b335c | 2015-06-11 18:51:20 -0700 | [diff] [blame] | 223 | int WebRtcIlbcfix_Decode30Ms(IlbcDecoderInstance* iLBCdec_inst, |
| 224 | const uint8_t* encoded, |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 225 | size_t len, |
Peter Kasting | a8b335c | 2015-06-11 18:51:20 -0700 | [diff] [blame] | 226 | int16_t* decoded, |
| 227 | int16_t* speechType) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 228 | { |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 229 | size_t i=0; |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 230 | if ((len==((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 231 | (len==2*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)|| |
| 232 | (len==3*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 233 | /* ok, do nothing */ |
| 234 | } else { |
| 235 | return(-1); |
| 236 | } |
| 237 | |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 238 | while ((i*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)<len) { |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 239 | WebRtcIlbcfix_DecodeImpl( |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 240 | &decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 241 | (const uint16_t*)&encoded |
jmarusic@webrtc.org | 71b35a4 | 2015-02-17 16:02:18 +0000 | [diff] [blame] | 242 | [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 243 | (IlbcDecoder*)iLBCdec_inst, 1); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 244 | i++; |
| 245 | } |
| 246 | /* iLBC does not support VAD/CNG yet */ |
| 247 | *speechType=1; |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 248 | return (int)(i*((IlbcDecoder*)iLBCdec_inst)->blockl); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 249 | } |
| 250 | |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 251 | size_t WebRtcIlbcfix_DecodePlc(IlbcDecoderInstance* iLBCdec_inst, |
| 252 | int16_t* decoded, |
| 253 | size_t noOfLostFrames) { |
| 254 | size_t i; |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 255 | uint16_t dummy; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 256 | |
| 257 | for (i=0;i<noOfLostFrames;i++) { |
| 258 | /* call decoder */ |
pbos@webrtc.org | e728ee0 | 2014-12-17 13:43:55 +0000 | [diff] [blame] | 259 | WebRtcIlbcfix_DecodeImpl( |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 260 | &decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], &dummy, |
| 261 | (IlbcDecoder*)iLBCdec_inst, 0); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 262 | } |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 263 | return (noOfLostFrames*((IlbcDecoder*)iLBCdec_inst)->blockl); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 264 | } |
| 265 | |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 266 | size_t WebRtcIlbcfix_NetEqPlc(IlbcDecoderInstance* iLBCdec_inst, |
| 267 | int16_t* decoded, |
| 268 | size_t noOfLostFrames) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 269 | /* Two input parameters not used, but needed for function pointers in NetEQ */ |
andrew@webrtc.org | 9562a36 | 2011-08-31 18:50:12 +0000 | [diff] [blame] | 270 | (void)(decoded = NULL); |
| 271 | (void)(noOfLostFrames = 0); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 272 | |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 273 | WebRtcSpl_MemSetW16(((IlbcDecoder*)iLBCdec_inst)->enh_buf, 0, ENH_BUFL); |
| 274 | ((IlbcDecoder*)iLBCdec_inst)->prev_enh_pl = 2; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 275 | |
| 276 | return (0); |
| 277 | } |
| 278 | |
leozwang@webrtc.org | 91b359e | 2012-02-28 17:26:14 +0000 | [diff] [blame] | 279 | void WebRtcIlbcfix_version(char *version) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 280 | { |
tina.legrand@webrtc.org | a41b4ce | 2011-08-29 08:19:30 +0000 | [diff] [blame] | 281 | strcpy((char*)version, "1.1.1"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 282 | } |