tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

g711_interface.c (1736B)


      1 /*
      2 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
      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 #include "modules/audio_coding/codecs/g711/g711_interface.h"
     12 
     13 #include <string.h>
     14 
     15 #include "modules/third_party/g711/g711.h"
     16 
     17 size_t WebRtcG711_EncodeA(const int16_t* speechIn,
     18                          size_t len,
     19                          uint8_t* encoded) {
     20  size_t n;
     21  for (n = 0; n < len; n++)
     22    encoded[n] = linear_to_alaw(speechIn[n]);
     23  return len;
     24 }
     25 
     26 size_t WebRtcG711_EncodeU(const int16_t* speechIn,
     27                          size_t len,
     28                          uint8_t* encoded) {
     29  size_t n;
     30  for (n = 0; n < len; n++)
     31    encoded[n] = linear_to_ulaw(speechIn[n]);
     32  return len;
     33 }
     34 
     35 size_t WebRtcG711_DecodeA(const uint8_t* encoded,
     36                          size_t len,
     37                          int16_t* decoded,
     38                          int16_t* speechType) {
     39  size_t n;
     40  for (n = 0; n < len; n++)
     41    decoded[n] = alaw_to_linear(encoded[n]);
     42  *speechType = 1;
     43  return len;
     44 }
     45 
     46 size_t WebRtcG711_DecodeU(const uint8_t* encoded,
     47                          size_t len,
     48                          int16_t* decoded,
     49                          int16_t* speechType) {
     50  size_t n;
     51  for (n = 0; n < len; n++)
     52    decoded[n] = ulaw_to_linear(encoded[n]);
     53  *speechType = 1;
     54  return len;
     55 }
     56 
     57 int16_t WebRtcG711_Version(char* version, int16_t lenBytes) {
     58  strncpy(version, "2.0.0", lenBytes);
     59  return 0;
     60 }