Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1228)

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_ISACFIX_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_ISACFIX_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_ISACFIX_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_ISACFIX_H_
13 13
14 #include <stddef.h>
15
14 #include "webrtc/modules/audio_coding/codecs/isac/bandwidth_info.h" 16 #include "webrtc/modules/audio_coding/codecs/isac/bandwidth_info.h"
15 #include "webrtc/typedefs.h" 17 #include "webrtc/typedefs.h"
16 18
17 typedef struct { 19 typedef struct {
18 void *dummy; 20 void *dummy;
19 } ISACFIX_MainStruct; 21 } ISACFIX_MainStruct;
20 22
21 23
22 #if defined(__cplusplus) 24 #if defined(__cplusplus)
23 extern "C" { 25 extern "C" {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 184
183 185
184 /**************************************************************************** 186 /****************************************************************************
185 * WebRtcIsacfix_UpdateBwEstimate1(...) 187 * WebRtcIsacfix_UpdateBwEstimate1(...)
186 * 188 *
187 * This function updates the estimate of the bandwidth. 189 * This function updates the estimate of the bandwidth.
188 * 190 *
189 * Input: 191 * Input:
190 * - ISAC_main_inst : ISAC instance. 192 * - ISAC_main_inst : ISAC instance.
191 * - encoded : encoded ISAC frame(s). 193 * - encoded : encoded ISAC frame(s).
192 * - packet_size : size of the packet. 194 * - packet_size : size of the packet in bytes.
193 * - rtp_seq_number : the RTP number of the packet. 195 * - rtp_seq_number : the RTP number of the packet.
194 * - arr_ts : the arrival time of the packet (from NetEq) 196 * - arr_ts : the arrival time of the packet (from NetEq)
195 * in samples. 197 * in samples.
196 * 198 *
197 * Return value : 0 - Ok 199 * Return value : 0 - Ok
198 * -1 - Error 200 * -1 - Error
199 */ 201 */
200 202
201 int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst, 203 int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst,
202 const uint8_t* encoded, 204 const uint8_t* encoded,
203 int32_t packet_size, 205 size_t packet_size,
204 uint16_t rtp_seq_number, 206 uint16_t rtp_seq_number,
205 uint32_t arr_ts); 207 uint32_t arr_ts);
206 208
207 /**************************************************************************** 209 /****************************************************************************
208 * WebRtcIsacfix_UpdateBwEstimate(...) 210 * WebRtcIsacfix_UpdateBwEstimate(...)
209 * 211 *
210 * This function updates the estimate of the bandwidth. 212 * This function updates the estimate of the bandwidth.
211 * 213 *
212 * Input: 214 * Input:
213 * - ISAC_main_inst : ISAC instance. 215 * - ISAC_main_inst : ISAC instance.
214 * - encoded : encoded ISAC frame(s). 216 * - encoded : encoded ISAC frame(s).
215 * - packet_size : size of the packet. 217 * - packet_size : size of the packet in bytes.
216 * - rtp_seq_number : the RTP number of the packet. 218 * - rtp_seq_number : the RTP number of the packet.
217 * - send_ts : the send time of the packet from RTP header, 219 * - send_ts : the send time of the packet from RTP header,
218 * in samples. 220 * in samples.
219 * - arr_ts : the arrival time of the packet (from NetEq) 221 * - arr_ts : the arrival time of the packet (from NetEq)
220 * in samples. 222 * in samples.
221 * 223 *
222 * Return value : 0 - Ok 224 * Return value : 0 - Ok
223 * -1 - Error 225 * -1 - Error
224 */ 226 */
225 227
226 int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst, 228 int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst,
227 const uint8_t* encoded, 229 const uint8_t* encoded,
228 int32_t packet_size, 230 size_t packet_size,
229 uint16_t rtp_seq_number, 231 uint16_t rtp_seq_number,
230 uint32_t send_ts, 232 uint32_t send_ts,
231 uint32_t arr_ts); 233 uint32_t arr_ts);
232 234
233 /**************************************************************************** 235 /****************************************************************************
234 * WebRtcIsacfix_Decode(...) 236 * WebRtcIsacfix_Decode(...)
235 * 237 *
236 * This function decodes an ISAC frame. Output speech length 238 * This function decodes an ISAC frame. Output speech length
237 * will be a multiple of 480 samples: 480 or 960 samples, 239 * will be a multiple of 480 samples: 480 or 960 samples,
238 * depending on the framesize (30 or 60 ms). 240 * depending on the framesize (30 or 60 ms).
239 * 241 *
240 * Input: 242 * Input:
241 * - ISAC_main_inst : ISAC instance. 243 * - ISAC_main_inst : ISAC instance.
242 * - encoded : encoded ISAC frame(s) 244 * - encoded : encoded ISAC frame(s)
243 * - len : bytes in encoded vector 245 * - len : bytes in encoded vector
244 * 246 *
245 * Output: 247 * Output:
246 * - decoded : The decoded vector 248 * - decoded : The decoded vector
247 * 249 *
248 * Return value : >0 - number of samples in decoded vector 250 * Return value : >0 - number of samples in decoded vector
249 * -1 - Error 251 * -1 - Error
250 */ 252 */
251 253
252 int WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst, 254 int WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst,
253 const uint8_t* encoded, 255 const uint8_t* encoded,
254 int16_t len, 256 size_t len,
255 int16_t *decoded, 257 int16_t *decoded,
256 int16_t *speechType); 258 int16_t *speechType);
257 259
258 260
259 /**************************************************************************** 261 /****************************************************************************
260 * WebRtcIsacfix_DecodeNb(...) 262 * WebRtcIsacfix_DecodeNb(...)
261 * 263 *
262 * This function decodes a ISAC frame in narrow-band (8 kHz sampling). 264 * This function decodes a ISAC frame in narrow-band (8 kHz sampling).
263 * Output speech length will be a multiple of 240 samples: 240 or 480 samples, 265 * Output speech length will be a multiple of 240 samples: 240 or 480 samples,
264 * depending on the framesize (30 or 60 ms). 266 * depending on the framesize (30 or 60 ms).
265 * 267 *
266 * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined 268 * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
267 * 269 *
268 * Input: 270 * Input:
269 * - ISAC_main_inst : ISAC instance. 271 * - ISAC_main_inst : ISAC instance.
270 * - encoded : encoded ISAC frame(s) 272 * - encoded : encoded ISAC frame(s)
271 * - len : bytes in encoded vector 273 * - len : bytes in encoded vector
272 * 274 *
273 * Output: 275 * Output:
274 * - decoded : The decoded vector 276 * - decoded : The decoded vector
275 * 277 *
276 * Return value : >0 - number of samples in decoded vector 278 * Return value : >0 - number of samples in decoded vector
277 * -1 - Error 279 * -1 - Error
278 */ 280 */
279 281
280 #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED 282 #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
281 int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, 283 int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst,
282 const uint16_t *encoded, 284 const uint16_t *encoded,
283 int16_t len, 285 size_t len,
284 int16_t *decoded, 286 int16_t *decoded,
285 int16_t *speechType); 287 int16_t *speechType);
286 #endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED 288 #endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
287 289
288 290
289 /**************************************************************************** 291 /****************************************************************************
290 * WebRtcIsacfix_DecodePlcNb(...) 292 * WebRtcIsacfix_DecodePlcNb(...)
291 * 293 *
292 * This function conducts PLC for ISAC frame(s) in narrow-band (8kHz sampling) . 294 * This function conducts PLC for ISAC frame(s) in narrow-band (8kHz sampling) .
293 * Output speech length will be "240*noOfLostFrames" samples 295 * Output speech length will be "240*noOfLostFrames" samples
294 * that equevalent of "30*noOfLostFrames" millisecond. 296 * that equevalent of "30*noOfLostFrames" millisecond.
295 * 297 *
296 * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined 298 * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
297 * 299 *
298 * Input: 300 * Input:
299 * - ISAC_main_inst : ISAC instance. 301 * - ISAC_main_inst : ISAC instance.
300 * - noOfLostFrames : Number of PLC frames (240 sample=30ms) to produc e 302 * - noOfLostFrames : Number of PLC frames (240 sample=30ms) to produc e
301 * NOTE! Maximum number is 2 (480 samples = 60ms) 303 * NOTE! Maximum number is 2 (480 samples = 60ms)
302 * 304 *
303 * Output: 305 * Output:
304 * - decoded : The decoded vector 306 * - decoded : The decoded vector
305 * 307 *
306 * Return value : >0 - number of samples in decoded PLC vector 308 * Return value : Number of samples in decoded PLC vector
307 * -1 - Error
308 */ 309 */
309 310
310 #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED 311 #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
311 int16_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst, 312 size_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst,
312 int16_t *decoded, 313 int16_t *decoded,
313 int16_t noOfLostFrames); 314 size_t noOfLostFrames);
314 #endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED 315 #endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
315 316
316 317
317 318
318 319
319 /**************************************************************************** 320 /****************************************************************************
320 * WebRtcIsacfix_DecodePlc(...) 321 * WebRtcIsacfix_DecodePlc(...)
321 * 322 *
322 * This function conducts PLC for ISAC frame(s) in wide-band (16kHz sampling). 323 * This function conducts PLC for ISAC frame(s) in wide-band (16kHz sampling).
323 * Output speech length will be "480*noOfLostFrames" samples 324 * Output speech length will be "480*noOfLostFrames" samples
324 * that is equevalent of "30*noOfLostFrames" millisecond. 325 * that is equevalent of "30*noOfLostFrames" millisecond.
325 * 326 *
326 * Input: 327 * Input:
327 * - ISAC_main_inst : ISAC instance. 328 * - ISAC_main_inst : ISAC instance.
328 * - noOfLostFrames : Number of PLC frames (480sample = 30ms) 329 * - noOfLostFrames : Number of PLC frames (480sample = 30ms)
329 * to produce 330 * to produce
330 * NOTE! Maximum number is 2 (960 samples = 60ms) 331 * NOTE! Maximum number is 2 (960 samples = 60ms)
331 * 332 *
332 * Output: 333 * Output:
333 * - decoded : The decoded vector 334 * - decoded : The decoded vector
334 * 335 *
335 * Return value : >0 - number of samples in decoded PLC vector 336 * Return value : Number of samples in decoded PLC vector
336 * -1 - Error
337 */ 337 */
338 338
339 int16_t WebRtcIsacfix_DecodePlc(ISACFIX_MainStruct *ISAC_main_inst, 339 size_t WebRtcIsacfix_DecodePlc(ISACFIX_MainStruct *ISAC_main_inst,
340 int16_t *decoded, 340 int16_t *decoded,
341 int16_t noOfLostFrames ); 341 size_t noOfLostFrames );
342 342
343 343
344 /**************************************************************************** 344 /****************************************************************************
345 * WebRtcIsacfix_ReadFrameLen(...) 345 * WebRtcIsacfix_ReadFrameLen(...)
346 * 346 *
347 * This function returns the length of the frame represented in the packet. 347 * This function returns the length of the frame represented in the packet.
348 * 348 *
349 * Input: 349 * Input:
350 * - encoded : Encoded bitstream 350 * - encoded : Encoded bitstream
351 * - encoded_len_bytes : Length of the bitstream in bytes. 351 * - encoded_len_bytes : Length of the bitstream in bytes.
352 * 352 *
353 * Output: 353 * Output:
354 * - frameLength : Length of frame in packet (in samples) 354 * - frameLength : Length of frame in packet (in samples)
355 * 355 *
356 */ 356 */
357 357
358 int16_t WebRtcIsacfix_ReadFrameLen(const uint8_t* encoded, 358 int16_t WebRtcIsacfix_ReadFrameLen(const uint8_t* encoded,
359 int encoded_len_bytes, 359 size_t encoded_len_bytes,
360 int16_t* frameLength); 360 size_t* frameLength);
361 361
362 /**************************************************************************** 362 /****************************************************************************
363 * WebRtcIsacfix_Control(...) 363 * WebRtcIsacfix_Control(...)
364 * 364 *
365 * This function sets the limit on the short-term average bit rate and the 365 * This function sets the limit on the short-term average bit rate and the
366 * frame length. Should be used only in Instantaneous mode. 366 * frame length. Should be used only in Instantaneous mode.
367 * 367 *
368 * Input: 368 * Input:
369 * - ISAC_main_inst : ISAC instance. 369 * - ISAC_main_inst : ISAC instance.
370 * - rate : limit on the short-term average bit rate, 370 * - rate : limit on the short-term average bit rate,
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 * Input: 601 * Input:
602 * - encoded : Encoded bitstream 602 * - encoded : Encoded bitstream
603 * - encoded_len_bytes : Length of the bitstream in bytes. 603 * - encoded_len_bytes : Length of the bitstream in bytes.
604 * 604 *
605 * Output: 605 * Output:
606 * - rateIndex : Bandwidth estimate in bitstream 606 * - rateIndex : Bandwidth estimate in bitstream
607 * 607 *
608 */ 608 */
609 609
610 int16_t WebRtcIsacfix_ReadBwIndex(const uint8_t* encoded, 610 int16_t WebRtcIsacfix_ReadBwIndex(const uint8_t* encoded,
611 int encoded_len_bytes, 611 size_t encoded_len_bytes,
612 int16_t* rateIndex); 612 int16_t* rateIndex);
613 613
614 614
615 /**************************************************************************** 615 /****************************************************************************
616 * WebRtcIsacfix_GetNewFrameLen(...) 616 * WebRtcIsacfix_GetNewFrameLen(...)
617 * 617 *
618 * This function return the next frame length (in samples) of iSAC. 618 * This function return the next frame length (in samples) of iSAC.
619 * 619 *
620 * Input: 620 * Input:
621 * -ISAC_main_inst : iSAC instance 621 * -ISAC_main_inst : iSAC instance
(...skipping 11 matching lines...) Expand all
633 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, 633 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst,
634 const IsacBandwidthInfo* bwinfo); 634 const IsacBandwidthInfo* bwinfo);
635 635
636 #if defined(__cplusplus) 636 #if defined(__cplusplus)
637 } 637 }
638 #endif 638 #endif
639 639
640 640
641 641
642 #endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_ISACFIX_H_ */ 642 #endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_ISACFIX_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698