<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212126] trunk/Source/ThirdParty/libwebrtc</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212126">212126</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-02-10 11:03:56 -0800 (Fri, 10 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebRTC] Activate libwebrtc G711/G722 audio codecs
https://bugs.webkit.org/show_bug.cgi?id=168123

Patch by Youenn Fablet &lt;youennf@gmail.com&gt; on 2017-02-10
Reviewed by Alex Christensen.

Adding G711/G722 missing codec files.
Activating use of these in the build system.

* Configurations/libwebrtc.xcconfig:
* Source/webrtc/modules/audio_coding/codecs/g711/g711.c: Added.
(ulaw_to_alaw):
* Source/webrtc/modules/audio_coding/codecs/g711/g711.h: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/g722_decode.c: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/g722_enc_dec.h: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/g722_encode.c: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.c: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.h: Added.
* Source/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc: Added.
* libwebrtc.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartylibwebrtcChangeLog">trunk/Source/ThirdParty/libwebrtc/ChangeLog</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcConfigurationslibwebrtcxcconfig">trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtclibwebrtcxcodeprojprojectpbxproj">trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg711g711c">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g711/g711.c</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg711g711h">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g711/g711.h</a></li>
<li>trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/</li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722audio_decoder_g722cc">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722audio_decoder_g722h">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722audio_encoder_g722cc">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722audio_encoder_g722h">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_decodec">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_decode.c</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_enc_dech">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_enc_dec.h</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_encodec">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_encode.c</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_interfacec">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.c</a></li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_interfaceh">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.h</a></li>
<li>trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/test/</li>
<li><a href="#trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722testtestG722cc">trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceThirdPartylibwebrtcChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (212125 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/ChangeLog        2017-02-10 18:56:07 UTC (rev 212125)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2017-02-10  Youenn Fablet  &lt;youennf@gmail.com&gt;
+
+        [WebRTC] Activate libwebrtc G711/G722 audio codecs
+        https://bugs.webkit.org/show_bug.cgi?id=168123
+
+        Reviewed by Alex Christensen.
+
+        Adding G711/G722 missing codec files.
+        Activating use of these in the build system.
+
+        * Configurations/libwebrtc.xcconfig:
+        * Source/webrtc/modules/audio_coding/codecs/g711/g711.c: Added.
+        (ulaw_to_alaw):
+        * Source/webrtc/modules/audio_coding/codecs/g711/g711.h: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/g722_decode.c: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/g722_enc_dec.h: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/g722_encode.c: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.c: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.h: Added.
+        * Source/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc: Added.
+        * libwebrtc.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2017-02-10  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix ASAN build.
</span></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcConfigurationslibwebrtcxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig (212125 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig        2017-02-10 18:56:07 UTC (rev 212125)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> USE_HEADERMAP = NO;
</span><span class="cx"> WARNING_CFLAGS = -Wno-exit-time-destructors -Wno-objc-property-no-attribute -Wno-objc-missing-super-calls -Wno-deprecated-declarations;
</span><span class="cx"> 
</span><del>-GCC_PREPROCESSOR_DEFINITIONS = WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_CODEC_ILBC WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED RTC_DISABLE_VP9 RTC_DISABLE_VP8 HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE HAVE_SCTP;
</del><ins>+GCC_PREPROCESSOR_DEFINITIONS = WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_CODEC_ILBC WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED RTC_DISABLE_VP9 RTC_DISABLE_VP8 HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE HAVE_SCTP WEBRTC_CODEC_G711 WEBRTC_CODEC_G722;
</ins><span class="cx"> 
</span><span class="cx"> GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*] = $(inherited);
</span><span class="cx"> GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*] = $(inherited) WEBRTC_IOS;
</span></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg711g711c"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g711/g711.c (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g711/g711.c                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g711/g711.c        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * g711.c - A-law and u-law transcoding routines
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2006 Steve Underwood
+ *
+ *  Despite my general liking of the GPL, I place this code in the
+ *  public domain for the benefit of all mankind - even the slimy
+ *  ones who might try to proprietize my work and use it to my
+ *  detriment.
+ *
+ * $Id: g711.c,v 1.1 2006/06/07 15:46:39 steveu Exp $
+ *
+ * Modifications for WebRtc, 2011/04/28, by tlegrand:
+ * -Removed unused include files
+ * -Changed to use WebRtc types
+ * -Added option to run encoder bitexact with ITU-T reference implementation
+ */
+
+#include &quot;g711.h&quot;
+#include &quot;webrtc/typedefs.h&quot;
+
+/* Copied from the CCITT G.711 specification */
+static const uint8_t ulaw_to_alaw_table[256] = {
+   42,  43,  40,  41,  46,  47,  44,  45,  34,  35,  32,  33,  38,  39,  36,
+   37,  58,  59,  56,  57,  62,  63,  60,  61,  50,  51,  48,  49,  54,  55,
+   52,  53,  10,  11,   8,   9,  14,  15,  12,  13,   2,   3,   0,   1,   6,
+    7,   4,  26,  27,  24,  25,  30,  31,  28,  29,  18,  19,  16,  17,  22,
+   23,  20,  21, 106, 104, 105, 110, 111, 108, 109,  98,  99,  96,  97, 102,
+  103, 100, 101, 122, 120, 126, 127, 124, 125, 114, 115, 112, 113, 118, 119,
+  116, 117,  75,  73,  79,  77,  66,  67,  64,  65,  70,  71,  68,  69,  90,
+   91,  88,  89,  94,  95,  92,  93,  82,  82,  83,  83,  80,  80,  81,  81,
+   86,  86,  87,  87,  84,  84,  85,  85, 170, 171, 168, 169, 174, 175, 172,
+  173, 162, 163, 160, 161, 166, 167, 164, 165, 186, 187, 184, 185, 190, 191,
+  188, 189, 178, 179, 176, 177, 182, 183, 180, 181, 138, 139, 136, 137, 142,
+  143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154, 155, 152, 153, 158,
+  159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234, 232, 233, 238,
+  239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248, 254, 255,
+  252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205, 194,
+  195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221,
+  210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213,
+  213
+};
+
+/* These transcoding tables are copied from the CCITT G.711 specification. To
+   achieve optimal results, do not change them. */
+static const uint8_t alaw_to_ulaw_table[256] = {
+   42,  43,  40,  41,  46,  47,  44,  45,  34,  35,  32,  33,  38,  39,  36,
+   37,  57,  58,  55,  56,  61,  62,  59,  60,  49,  50,  47,  48,  53,  54,
+   51,  52,  10,  11,   8,   9,  14,  15,  12,  13,   2,   3,   0,   1,   6,
+    7,   4,   5,  26,  27,  24,  25,  30,  31,  28,  29,  18,  19,  16,  17,
+   22,  23,  20,  21,  98,  99,  96,  97, 102, 103, 100, 101,  93,  93,  92,
+   92,  95,  95,  94,  94, 116, 118, 112, 114, 124, 126, 120, 122, 106, 107,
+  104, 105, 110, 111, 108, 109,  72,  73,  70,  71,  76,  77,  74,  75,  64,
+   65,  63,  63,  68,  69,  66,  67,  86,  87,  84,  85,  90,  91,  88,  89,
+   79,  79,  78,  78,  82,  83,  80,  81, 170, 171, 168, 169, 174, 175, 172,
+  173, 162, 163, 160, 161, 166, 167, 164, 165, 185, 186, 183, 184, 189, 190,
+  187, 188, 177, 178, 175, 176, 181, 182, 179, 180, 138, 139, 136, 137, 142,
+  143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133, 154, 155, 152, 153,
+  158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 226, 227, 224,
+  225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222, 244, 246,
+  240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237, 200,
+  201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195,
+  214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208,
+  209
+};
+
+uint8_t alaw_to_ulaw(uint8_t alaw) { return alaw_to_ulaw_table[alaw]; }
+
+uint8_t ulaw_to_alaw(uint8_t ulaw) { return ulaw_to_alaw_table[ulaw]; }
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg711g711h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g711/g711.h (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g711/g711.h                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g711/g711.h        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,344 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * g711.h - In line A-law and u-law conversion routines
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ *  Despite my general liking of the GPL, I place this code in the
+ *  public domain for the benefit of all mankind - even the slimy
+ *  ones who might try to proprietize my work and use it to my
+ *  detriment.
+ *
+ * $Id: g711.h,v 1.1 2006/06/07 15:46:39 steveu Exp $
+ *
+ * Modifications for WebRtc, 2011/04/28, by tlegrand:
+ * -Changed to use WebRtc types
+ * -Changed __inline__ to __inline
+ * -Two changes to make implementation bitexact with ITU-T reference implementation
+ */
+
+/*! \page g711_page A-law and mu-law handling
+Lookup tables for A-law and u-law look attractive, until you consider the impact
+on the CPU cache. If it causes a substantial area of your processor cache to get
+hit too often, cache sloshing will severely slow things down. The main reason
+these routines are slow in C, is the lack of direct access to the CPU's &quot;find
+the first 1&quot; instruction. A little in-line assembler fixes that, and the
+conversion routines can be faster than lookup tables, in most real world usage.
+A &quot;find the first 1&quot; instruction is available on most modern CPUs, and is a
+much underused feature.
+
+If an assembly language method of bit searching is not available, these routines
+revert to a method that can be a little slow, so the cache thrashing might not
+seem so bad :(
+
+Feel free to submit patches to add fast &quot;find the first 1&quot; support for your own
+favourite processor.
+
+Look up tables are used for transcoding between A-law and u-law, since it is
+difficult to achieve the precise transcoding procedure laid down in the G.711
+specification by other means.
+*/
+
+#if !defined(_G711_H_)
+#define _G711_H_
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
+#include &quot;webrtc/typedefs.h&quot;
+
+#if defined(__i386__)
+/*! \brief Find the bit position of the highest set bit in a word
+    \param bits The word to be searched
+    \return The bit number of the highest set bit, or -1 if the word is zero. */
+static __inline__ int top_bit(unsigned int bits) {
+  int res;
+
+  __asm__ __volatile__(&quot; movl $-1,%%edx;\n&quot;
+                       &quot; bsrl %%eax,%%edx;\n&quot;
+                       : &quot;=d&quot; (res)
+                       : &quot;a&quot; (bits));
+  return res;
+}
+
+/*! \brief Find the bit position of the lowest set bit in a word
+    \param bits The word to be searched
+    \return The bit number of the lowest set bit, or -1 if the word is zero. */
+static __inline__ int bottom_bit(unsigned int bits) {
+  int res;
+
+  __asm__ __volatile__(&quot; movl $-1,%%edx;\n&quot;
+                       &quot; bsfl %%eax,%%edx;\n&quot;
+                       : &quot;=d&quot; (res)
+                       : &quot;a&quot; (bits));
+  return res;
+}
+#elif defined(__x86_64__)
+static __inline__ int top_bit(unsigned int bits) {
+  int res;
+
+  __asm__ __volatile__(&quot; movq $-1,%%rdx;\n&quot;
+                       &quot; bsrq %%rax,%%rdx;\n&quot;
+                       : &quot;=d&quot; (res)
+                       : &quot;a&quot; (bits));
+  return res;
+}
+
+static __inline__ int bottom_bit(unsigned int bits) {
+  int res;
+
+  __asm__ __volatile__(&quot; movq $-1,%%rdx;\n&quot;
+                       &quot; bsfq %%rax,%%rdx;\n&quot;
+                       : &quot;=d&quot; (res)
+                       : &quot;a&quot; (bits));
+  return res;
+}
+#else
+static __inline int top_bit(unsigned int bits) {
+  int i;
+
+  if (bits == 0) {
+    return -1;
+  }
+  i = 0;
+  if (bits &amp; 0xFFFF0000) {
+    bits &amp;= 0xFFFF0000;
+    i += 16;
+  }
+  if (bits &amp; 0xFF00FF00) {
+    bits &amp;= 0xFF00FF00;
+    i += 8;
+  }
+  if (bits &amp; 0xF0F0F0F0) {
+    bits &amp;= 0xF0F0F0F0;
+    i += 4;
+  }
+  if (bits &amp; 0xCCCCCCCC) {
+    bits &amp;= 0xCCCCCCCC;
+    i += 2;
+  }
+  if (bits &amp; 0xAAAAAAAA) {
+    bits &amp;= 0xAAAAAAAA;
+    i += 1;
+  }
+  return i;
+}
+
+static __inline int bottom_bit(unsigned int bits) {
+  int i;
+
+  if (bits == 0) {
+    return -1;
+  }
+  i = 32;
+  if (bits &amp; 0x0000FFFF) {
+    bits &amp;= 0x0000FFFF;
+    i -= 16;
+  }
+  if (bits &amp; 0x00FF00FF) {
+    bits &amp;= 0x00FF00FF;
+    i -= 8;
+  }
+  if (bits &amp; 0x0F0F0F0F) {
+    bits &amp;= 0x0F0F0F0F;
+    i -= 4;
+  }
+  if (bits &amp; 0x33333333) {
+    bits &amp;= 0x33333333;
+    i -= 2;
+  }
+  if (bits &amp; 0x55555555) {
+    bits &amp;= 0x55555555;
+    i -= 1;
+  }
+  return i;
+}
+#endif
+
+/* N.B. It is tempting to use look-up tables for A-law and u-law conversion.
+ *      However, you should consider the cache footprint.
+ *
+ *      A 64K byte table for linear to x-law and a 512 byte table for x-law to
+ *      linear sound like peanuts these days, and shouldn't an array lookup be
+ *      real fast? No! When the cache sloshes as badly as this one will, a tight
+ *      calculation may be better. The messiest part is normally finding the
+ *      segment, but a little inline assembly can fix that on an i386, x86_64 and
+ *      many other modern processors.
+ */
+
+/*
+ * Mu-law is basically as follows:
+ *
+ *      Biased Linear Input Code        Compressed Code
+ *      ------------------------        ---------------
+ *      00000001wxyza                   000wxyz
+ *      0000001wxyzab                   001wxyz
+ *      000001wxyzabc                   010wxyz
+ *      00001wxyzabcd                   011wxyz
+ *      0001wxyzabcde                   100wxyz
+ *      001wxyzabcdef                   101wxyz
+ *      01wxyzabcdefg                   110wxyz
+ *      1wxyzabcdefgh                   111wxyz
+ *
+ * Each biased linear code has a leading 1 which identifies the segment
+ * number. The value of the segment number is equal to 7 minus the number
+ * of leading 0's. The quantization interval is directly available as the
+ * four bits wxyz.  * The trailing bits (a - h) are ignored.
+ *
+ * Ordinarily the complement of the resulting code word is used for
+ * transmission, and so the code word is complemented before it is returned.
+ *
+ * For further information see John C. Bellamy's Digital Telephony, 1982,
+ * John Wiley &amp; Sons, pps 98-111 and 472-476.
+ */
+
+//#define ULAW_ZEROTRAP                 /* turn on the trap as per the MIL-STD */
+#define ULAW_BIAS 0x84  /* Bias for linear code. */
+
+/*! \brief Encode a linear sample to u-law
+    \param linear The sample to encode.
+    \return The u-law value.
+*/
+static __inline uint8_t linear_to_ulaw(int linear) {
+  uint8_t u_val;
+  int mask;
+  int seg;
+
+  /* Get the sign and the magnitude of the value. */
+  if (linear &lt; 0) {
+    /* WebRtc, tlegrand: -1 added to get bitexact to reference implementation */
+    linear = ULAW_BIAS - linear - 1;
+    mask = 0x7F;
+  } else {
+    linear = ULAW_BIAS + linear;
+    mask = 0xFF;
+  }
+
+  seg = top_bit(linear | 0xFF) - 7;
+
+  /*
+   * Combine the sign, segment, quantization bits,
+   * and complement the code word.
+   */
+  if (seg &gt;= 8)
+    u_val = (uint8_t)(0x7F ^ mask);
+  else
+    u_val = (uint8_t)(((seg &lt;&lt; 4) | ((linear &gt;&gt; (seg + 3)) &amp; 0xF)) ^ mask);
+#ifdef ULAW_ZEROTRAP
+  /* Optional ITU trap */
+  if (u_val == 0)
+    u_val = 0x02;
+#endif
+  return u_val;
+}
+
+/*! \brief Decode an u-law sample to a linear value.
+    \param ulaw The u-law sample to decode.
+    \return The linear value.
+*/
+static __inline int16_t ulaw_to_linear(uint8_t ulaw) {
+  int t;
+
+  /* Complement to obtain normal u-law value. */
+  ulaw = ~ulaw;
+  /*
+   * Extract and bias the quantization bits. Then
+   * shift up by the segment number and subtract out the bias.
+   */
+  t = (((ulaw &amp; 0x0F) &lt;&lt; 3) + ULAW_BIAS) &lt;&lt; (((int) ulaw &amp; 0x70) &gt;&gt; 4);
+  return (int16_t)((ulaw &amp; 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
+}
+
+/*
+ * A-law is basically as follows:
+ *
+ *      Linear Input Code        Compressed Code
+ *      -----------------        ---------------
+ *      0000000wxyza             000wxyz
+ *      0000001wxyza             001wxyz
+ *      000001wxyzab             010wxyz
+ *      00001wxyzabc             011wxyz
+ *      0001wxyzabcd             100wxyz
+ *      001wxyzabcde             101wxyz
+ *      01wxyzabcdef             110wxyz
+ *      1wxyzabcdefg             111wxyz
+ *
+ * For further information see John C. Bellamy's Digital Telephony, 1982,
+ * John Wiley &amp; Sons, pps 98-111 and 472-476.
+ */
+
+#define ALAW_AMI_MASK 0x55
+
+/*! \brief Encode a linear sample to A-law
+    \param linear The sample to encode.
+    \return The A-law value.
+*/
+static __inline uint8_t linear_to_alaw(int linear) {
+  int mask;
+  int seg;
+
+  if (linear &gt;= 0) {
+    /* Sign (bit 7) bit = 1 */
+    mask = ALAW_AMI_MASK | 0x80;
+  } else {
+    /* Sign (bit 7) bit = 0 */
+    mask = ALAW_AMI_MASK;
+    /* WebRtc, tlegrand: Changed from -8 to -1 to get bitexact to reference
+     * implementation */
+    linear = -linear - 1;
+  }
+
+  /* Convert the scaled magnitude to segment number. */
+  seg = top_bit(linear | 0xFF) - 7;
+  if (seg &gt;= 8) {
+    if (linear &gt;= 0) {
+      /* Out of range. Return maximum value. */
+      return (uint8_t)(0x7F ^ mask);
+    }
+    /* We must be just a tiny step below zero */
+    return (uint8_t)(0x00 ^ mask);
+  }
+  /* Combine the sign, segment, and quantization bits. */
+  return (uint8_t)(((seg &lt;&lt; 4) | ((linear &gt;&gt; ((seg) ? (seg + 3) : 4)) &amp; 0x0F)) ^
+                   mask);
+}
+
+/*! \brief Decode an A-law sample to a linear value.
+    \param alaw The A-law sample to decode.
+    \return The linear value.
+*/
+static __inline int16_t alaw_to_linear(uint8_t alaw) {
+  int i;
+  int seg;
+
+  alaw ^= ALAW_AMI_MASK;
+  i = ((alaw &amp; 0x0F) &lt;&lt; 4);
+  seg = (((int) alaw &amp; 0x70) &gt;&gt; 4);
+  if (seg)
+    i = (i + 0x108) &lt;&lt; (seg - 1);
+  else
+    i += 8;
+  return (int16_t)((alaw &amp; 0x80) ? i : -i);
+}
+
+/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711.
+    \param alaw The A-law sample to transcode.
+    \return The best matching u-law value.
+*/
+uint8_t alaw_to_ulaw(uint8_t alaw);
+
+/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
+    \param alaw The u-law sample to transcode.
+    \return The best matching A-law value.
+*/
+uint8_t ulaw_to_alaw(uint8_t ulaw);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722audio_decoder_g722cc"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,161 @@
</span><ins>+/*
+ *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include &quot;webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h&quot;
+
+#include &lt;string.h&gt;
+
+#include &quot;webrtc/base/checks.h&quot;
+#include &quot;webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h&quot;
+#include &quot;webrtc/modules/audio_coding/codecs/g722/g722_interface.h&quot;
+
+namespace webrtc {
+
+AudioDecoderG722::AudioDecoderG722() {
+  WebRtcG722_CreateDecoder(&amp;dec_state_);
+  WebRtcG722_DecoderInit(dec_state_);
+}
+
+AudioDecoderG722::~AudioDecoderG722() {
+  WebRtcG722_FreeDecoder(dec_state_);
+}
+
+bool AudioDecoderG722::HasDecodePlc() const {
+  return false;
+}
+
+int AudioDecoderG722::DecodeInternal(const uint8_t* encoded,
+                                     size_t encoded_len,
+                                     int sample_rate_hz,
+                                     int16_t* decoded,
+                                     SpeechType* speech_type) {
+  RTC_DCHECK_EQ(SampleRateHz(), sample_rate_hz);
+  int16_t temp_type = 1;  // Default is speech.
+  size_t ret =
+      WebRtcG722_Decode(dec_state_, encoded, encoded_len, decoded, &amp;temp_type);
+  *speech_type = ConvertSpeechType(temp_type);
+  return static_cast&lt;int&gt;(ret);
+}
+
+void AudioDecoderG722::Reset() {
+  WebRtcG722_DecoderInit(dec_state_);
+}
+
+std::vector&lt;AudioDecoder::ParseResult&gt; AudioDecoderG722::ParsePayload(
+    rtc::Buffer&amp;&amp; payload,
+    uint32_t timestamp) {
+  return LegacyEncodedAudioFrame::SplitBySamples(this, std::move(payload),
+                                                 timestamp, 8, 16);
+}
+
+int AudioDecoderG722::PacketDuration(const uint8_t* encoded,
+                                     size_t encoded_len) const {
+  // 1/2 encoded byte per sample per channel.
+  return static_cast&lt;int&gt;(2 * encoded_len / Channels());
+}
+
+int AudioDecoderG722::SampleRateHz() const {
+  return 16000;
+}
+
+size_t AudioDecoderG722::Channels() const {
+  return 1;
+}
+
+AudioDecoderG722Stereo::AudioDecoderG722Stereo() {
+  WebRtcG722_CreateDecoder(&amp;dec_state_left_);
+  WebRtcG722_CreateDecoder(&amp;dec_state_right_);
+  WebRtcG722_DecoderInit(dec_state_left_);
+  WebRtcG722_DecoderInit(dec_state_right_);
+}
+
+AudioDecoderG722Stereo::~AudioDecoderG722Stereo() {
+  WebRtcG722_FreeDecoder(dec_state_left_);
+  WebRtcG722_FreeDecoder(dec_state_right_);
+}
+
+int AudioDecoderG722Stereo::DecodeInternal(const uint8_t* encoded,
+                                           size_t encoded_len,
+                                           int sample_rate_hz,
+                                           int16_t* decoded,
+                                           SpeechType* speech_type) {
+  RTC_DCHECK_EQ(SampleRateHz(), sample_rate_hz);
+  int16_t temp_type = 1;  // Default is speech.
+  // De-interleave the bit-stream into two separate payloads.
+  uint8_t* encoded_deinterleaved = new uint8_t[encoded_len];
+  SplitStereoPacket(encoded, encoded_len, encoded_deinterleaved);
+  // Decode left and right.
+  size_t decoded_len = WebRtcG722_Decode(dec_state_left_, encoded_deinterleaved,
+                                         encoded_len / 2, decoded, &amp;temp_type);
+  size_t ret = WebRtcG722_Decode(
+      dec_state_right_, &amp;encoded_deinterleaved[encoded_len / 2],
+      encoded_len / 2, &amp;decoded[decoded_len], &amp;temp_type);
+  if (ret == decoded_len) {
+    ret += decoded_len;  // Return total number of samples.
+    // Interleave output.
+    for (size_t k = ret / 2; k &lt; ret; k++) {
+      int16_t temp = decoded[k];
+      memmove(&amp;decoded[2 * k - ret + 2], &amp;decoded[2 * k - ret + 1],
+              (ret - k - 1) * sizeof(int16_t));
+      decoded[2 * k - ret + 1] = temp;
+    }
+  }
+  *speech_type = ConvertSpeechType(temp_type);
+  delete[] encoded_deinterleaved;
+  return static_cast&lt;int&gt;(ret);
+}
+
+int AudioDecoderG722Stereo::SampleRateHz() const {
+  return 16000;
+}
+
+size_t AudioDecoderG722Stereo::Channels() const {
+  return 2;
+}
+
+void AudioDecoderG722Stereo::Reset() {
+  WebRtcG722_DecoderInit(dec_state_left_);
+  WebRtcG722_DecoderInit(dec_state_right_);
+}
+
+std::vector&lt;AudioDecoder::ParseResult&gt; AudioDecoderG722Stereo::ParsePayload(
+    rtc::Buffer&amp;&amp; payload,
+    uint32_t timestamp) {
+  return LegacyEncodedAudioFrame::SplitBySamples(this, std::move(payload),
+                                                 timestamp, 2 * 8, 16);
+}
+
+// Split the stereo packet and place left and right channel after each other
+// in the output array.
+void AudioDecoderG722Stereo::SplitStereoPacket(const uint8_t* encoded,
+                                               size_t encoded_len,
+                                               uint8_t* encoded_deinterleaved) {
+  // Regroup the 4 bits/sample so |l1 l2| |r1 r2| |l3 l4| |r3 r4| ...,
+  // where &quot;lx&quot; is 4 bits representing left sample number x, and &quot;rx&quot; right
+  // sample. Two samples fit in one byte, represented with |...|.
+  for (size_t i = 0; i + 1 &lt; encoded_len; i += 2) {
+    uint8_t right_byte = ((encoded[i] &amp; 0x0F) &lt;&lt; 4) + (encoded[i + 1] &amp; 0x0F);
+    encoded_deinterleaved[i] = (encoded[i] &amp; 0xF0) + (encoded[i + 1] &gt;&gt; 4);
+    encoded_deinterleaved[i + 1] = right_byte;
+  }
+
+  // Move one byte representing right channel each loop, and place it at the
+  // end of the bytestream vector. After looping the data is reordered to:
+  // |l1 l2| |l3 l4| ... |l(N-1) lN| |r1 r2| |r3 r4| ... |r(N-1) r(N)|,
+  // where N is the total number of samples.
+  for (size_t i = 0; i &lt; encoded_len / 2; i++) {
+    uint8_t right_byte = encoded_deinterleaved[i + 1];
+    memmove(&amp;encoded_deinterleaved[i + 1], &amp;encoded_deinterleaved[i + 2],
+            encoded_len - i - 2);
+    encoded_deinterleaved[encoded_len - 1] = right_byte;
+  }
+}
+
+}  // namespace webrtc
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722audio_decoder_g722h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+/*
+ *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_DECODER_G722_H_
+#define WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_DECODER_G722_H_
+
+#include &quot;webrtc/base/constructormagic.h&quot;
+#include &quot;webrtc/modules/audio_coding/codecs/audio_decoder.h&quot;
+
+typedef struct WebRtcG722DecInst G722DecInst;
+
+namespace webrtc {
+
+class AudioDecoderG722 final : public AudioDecoder {
+ public:
+  AudioDecoderG722();
+  ~AudioDecoderG722() override;
+  bool HasDecodePlc() const override;
+  void Reset() override;
+  std::vector&lt;ParseResult&gt; ParsePayload(rtc::Buffer&amp;&amp; payload,
+                                        uint32_t timestamp) override;
+  int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
+  int SampleRateHz() const override;
+  size_t Channels() const override;
+
+ protected:
+  int DecodeInternal(const uint8_t* encoded,
+                     size_t encoded_len,
+                     int sample_rate_hz,
+                     int16_t* decoded,
+                     SpeechType* speech_type) override;
+
+ private:
+  G722DecInst* dec_state_;
+  RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722);
+};
+
+class AudioDecoderG722Stereo final : public AudioDecoder {
+ public:
+  AudioDecoderG722Stereo();
+  ~AudioDecoderG722Stereo() override;
+  void Reset() override;
+  std::vector&lt;ParseResult&gt; ParsePayload(rtc::Buffer&amp;&amp; payload,
+                                        uint32_t timestamp) override;
+  int SampleRateHz() const override;
+  size_t Channels() const override;
+
+ protected:
+  int DecodeInternal(const uint8_t* encoded,
+                     size_t encoded_len,
+                     int sample_rate_hz,
+                     int16_t* decoded,
+                     SpeechType* speech_type) override;
+
+ private:
+  // Splits the stereo-interleaved payload in |encoded| into separate payloads
+  // for left and right channels. The separated payloads are written to
+  // |encoded_deinterleaved|, which must hold at least |encoded_len| samples.
+  // The left channel starts at offset 0, while the right channel starts at
+  // offset encoded_len / 2 into |encoded_deinterleaved|.
+  void SplitStereoPacket(const uint8_t* encoded,
+                         size_t encoded_len,
+                         uint8_t* encoded_deinterleaved);
+
+  G722DecInst* dec_state_left_;
+  G722DecInst* dec_state_right_;
+  RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo);
+};
+
+}  // namespace webrtc
+
+#endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_DECODER_G722_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722audio_encoder_g722cc"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,164 @@
</span><ins>+/*
+ *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include &quot;webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h&quot;
+
+#include &lt;limits&gt;
+#include &quot;webrtc/base/checks.h&quot;
+#include &quot;webrtc/common_types.h&quot;
+#include &quot;webrtc/modules/audio_coding/codecs/g722/g722_interface.h&quot;
+
+namespace webrtc {
+
+namespace {
+
+const size_t kSampleRateHz = 16000;
+
+AudioEncoderG722::Config CreateConfig(const CodecInst&amp; codec_inst) {
+  AudioEncoderG722::Config config;
+  config.num_channels = codec_inst.channels;
+  config.frame_size_ms = codec_inst.pacsize / 16;
+  config.payload_type = codec_inst.pltype;
+  return config;
+}
+
+}  // namespace
+
+bool AudioEncoderG722::Config::IsOk() const {
+  return (frame_size_ms &gt; 0) &amp;&amp; (frame_size_ms % 10 == 0) &amp;&amp;
+      (num_channels &gt;= 1);
+}
+
+AudioEncoderG722::AudioEncoderG722(const Config&amp; config)
+    : num_channels_(config.num_channels),
+      payload_type_(config.payload_type),
+      num_10ms_frames_per_packet_(
+          static_cast&lt;size_t&gt;(config.frame_size_ms / 10)),
+      num_10ms_frames_buffered_(0),
+      first_timestamp_in_buffer_(0),
+      encoders_(new EncoderState[num_channels_]),
+      interleave_buffer_(2 * num_channels_) {
+  RTC_CHECK(config.IsOk());
+  const size_t samples_per_channel =
+      kSampleRateHz / 100 * num_10ms_frames_per_packet_;
+  for (size_t i = 0; i &lt; num_channels_; ++i) {
+    encoders_[i].speech_buffer.reset(new int16_t[samples_per_channel]);
+    encoders_[i].encoded_buffer.SetSize(samples_per_channel / 2);
+  }
+  Reset();
+}
+
+AudioEncoderG722::AudioEncoderG722(const CodecInst&amp; codec_inst)
+    : AudioEncoderG722(CreateConfig(codec_inst)) {}
+
+AudioEncoderG722::~AudioEncoderG722() = default;
+
+int AudioEncoderG722::SampleRateHz() const {
+  return kSampleRateHz;
+}
+
+size_t AudioEncoderG722::NumChannels() const {
+  return num_channels_;
+}
+
+int AudioEncoderG722::RtpTimestampRateHz() const {
+  // The RTP timestamp rate for G.722 is 8000 Hz, even though it is a 16 kHz
+  // codec.
+  return kSampleRateHz / 2;
+}
+
+size_t AudioEncoderG722::Num10MsFramesInNextPacket() const {
+  return num_10ms_frames_per_packet_;
+}
+
+size_t AudioEncoderG722::Max10MsFramesInAPacket() const {
+  return num_10ms_frames_per_packet_;
+}
+
+int AudioEncoderG722::GetTargetBitrate() const {
+  // 4 bits/sample, 16000 samples/s/channel.
+  return static_cast&lt;int&gt;(64000 * NumChannels());
+}
+
+void AudioEncoderG722::Reset() {
+  num_10ms_frames_buffered_ = 0;
+  for (size_t i = 0; i &lt; num_channels_; ++i)
+    RTC_CHECK_EQ(0, WebRtcG722_EncoderInit(encoders_[i].encoder));
+}
+
+AudioEncoder::EncodedInfo AudioEncoderG722::EncodeImpl(
+    uint32_t rtp_timestamp,
+    rtc::ArrayView&lt;const int16_t&gt; audio,
+    rtc::Buffer* encoded) {
+  if (num_10ms_frames_buffered_ == 0)
+    first_timestamp_in_buffer_ = rtp_timestamp;
+
+  // Deinterleave samples and save them in each channel's buffer.
+  const size_t start = kSampleRateHz / 100 * num_10ms_frames_buffered_;
+  for (size_t i = 0; i &lt; kSampleRateHz / 100; ++i)
+    for (size_t j = 0; j &lt; num_channels_; ++j)
+      encoders_[j].speech_buffer[start + i] = audio[i * num_channels_ + j];
+
+  // If we don't yet have enough samples for a packet, we're done for now.
+  if (++num_10ms_frames_buffered_ &lt; num_10ms_frames_per_packet_) {
+    return EncodedInfo();
+  }
+
+  // Encode each channel separately.
+  RTC_CHECK_EQ(num_10ms_frames_buffered_, num_10ms_frames_per_packet_);
+  num_10ms_frames_buffered_ = 0;
+  const size_t samples_per_channel = SamplesPerChannel();
+  for (size_t i = 0; i &lt; num_channels_; ++i) {
+    const size_t bytes_encoded = WebRtcG722_Encode(
+        encoders_[i].encoder, encoders_[i].speech_buffer.get(),
+        samples_per_channel, encoders_[i].encoded_buffer.data());
+    RTC_CHECK_EQ(bytes_encoded, samples_per_channel / 2);
+  }
+
+  const size_t bytes_to_encode = samples_per_channel / 2 * num_channels_;
+  EncodedInfo info;
+  info.encoded_bytes = encoded-&gt;AppendData(
+      bytes_to_encode, [&amp;] (rtc::ArrayView&lt;uint8_t&gt; encoded) {
+        // Interleave the encoded bytes of the different channels. Each separate
+        // channel and the interleaved stream encodes two samples per byte, most
+        // significant half first.
+        for (size_t i = 0; i &lt; samples_per_channel / 2; ++i) {
+          for (size_t j = 0; j &lt; num_channels_; ++j) {
+            uint8_t two_samples = encoders_[j].encoded_buffer.data()[i];
+            interleave_buffer_.data()[j] = two_samples &gt;&gt; 4;
+            interleave_buffer_.data()[num_channels_ + j] = two_samples &amp; 0xf;
+          }
+          for (size_t j = 0; j &lt; num_channels_; ++j)
+            encoded[i * num_channels_ + j] =
+                interleave_buffer_.data()[2 * j] &lt;&lt; 4 |
+                interleave_buffer_.data()[2 * j + 1];
+        }
+
+        return bytes_to_encode;
+      });
+  info.encoded_timestamp = first_timestamp_in_buffer_;
+  info.payload_type = payload_type_;
+  info.encoder_type = CodecType::kG722;
+  return info;
+}
+
+AudioEncoderG722::EncoderState::EncoderState() {
+  RTC_CHECK_EQ(0, WebRtcG722_CreateEncoder(&amp;encoder));
+}
+
+AudioEncoderG722::EncoderState::~EncoderState() {
+  RTC_CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder));
+}
+
+size_t AudioEncoderG722::SamplesPerChannel() const {
+  return kSampleRateHz / 100 * num_10ms_frames_per_packet_;
+}
+
+}  // namespace webrtc
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722audio_encoder_g722h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_
+#define WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_
+
+#include &lt;memory&gt;
+
+#include &quot;webrtc/base/buffer.h&quot;
+#include &quot;webrtc/base/constructormagic.h&quot;
+#include &quot;webrtc/modules/audio_coding/codecs/audio_encoder.h&quot;
+#include &quot;webrtc/modules/audio_coding/codecs/g722/g722_interface.h&quot;
+
+namespace webrtc {
+
+struct CodecInst;
+
+class AudioEncoderG722 final : public AudioEncoder {
+ public:
+  struct Config {
+    bool IsOk() const;
+
+    int payload_type = 9;
+    int frame_size_ms = 20;
+    size_t num_channels = 1;
+  };
+
+  explicit AudioEncoderG722(const Config&amp; config);
+  explicit AudioEncoderG722(const CodecInst&amp; codec_inst);
+  ~AudioEncoderG722() override;
+
+  int SampleRateHz() const override;
+  size_t NumChannels() const override;
+  int RtpTimestampRateHz() const override;
+  size_t Num10MsFramesInNextPacket() const override;
+  size_t Max10MsFramesInAPacket() const override;
+  int GetTargetBitrate() const override;
+  void Reset() override;
+
+ protected:
+  EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
+                         rtc::ArrayView&lt;const int16_t&gt; audio,
+                         rtc::Buffer* encoded) override;
+
+ private:
+  // The encoder state for one channel.
+  struct EncoderState {
+    G722EncInst* encoder;
+    std::unique_ptr&lt;int16_t[]&gt; speech_buffer;   // Queued up for encoding.
+    rtc::Buffer encoded_buffer;                 // Already encoded.
+    EncoderState();
+    ~EncoderState();
+  };
+
+  size_t SamplesPerChannel() const;
+
+  const size_t num_channels_;
+  const int payload_type_;
+  const size_t num_10ms_frames_per_packet_;
+  size_t num_10ms_frames_buffered_;
+  uint32_t first_timestamp_in_buffer_;
+  const std::unique_ptr&lt;EncoderState[]&gt; encoders_;
+  rtc::Buffer interleave_buffer_;
+  RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderG722);
+};
+
+}  // namespace webrtc
+#endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_decodec"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_decode.c (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_decode.c                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_decode.c        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,400 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * g722_decode.c - The ITU G.722 codec, decode part.
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ *  Despite my general liking of the GPL, I place my own contributions
+ *  to this code in the public domain for the benefit of all mankind -
+ *  even the slimy ones who might try to proprietize my work and use it
+ *  to my detriment.
+ *
+ * Based in part on a single channel G.722 codec which is:
+ *
+ * Copyright (c) CMU 1993
+ * Computer Science, Speech Group
+ * Chengxiang Lu and Alex Hauptmann
+ *
+ * $Id: g722_decode.c,v 1.15 2006/07/07 16:37:49 steveu Exp $
+ *
+ * Modifications for WebRtc, 2011/04/28, by tlegrand:
+ * -Removed usage of inttypes.h and tgmath.h
+ * -Changed to use WebRtc types
+ * -Changed __inline__ to __inline
+ * -Added saturation check on output
+ */
+
+/*! \file */
+
+
+#include &lt;memory.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+
+#include &quot;g722_enc_dec.h&quot;
+#include &quot;webrtc/typedefs.h&quot;
+
+#if !defined(FALSE)
+#define FALSE 0
+#endif
+#if !defined(TRUE)
+#define TRUE (!FALSE)
+#endif
+
+static __inline int16_t saturate(int32_t amp)
+{
+    int16_t amp16;
+
+    /* Hopefully this is optimised for the common case - not clipping */
+    amp16 = (int16_t) amp;
+    if (amp == amp16)
+        return amp16;
+    if (amp &gt; WEBRTC_INT16_MAX)
+        return  WEBRTC_INT16_MAX;
+    return  WEBRTC_INT16_MIN;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void block4(G722DecoderState *s, int band, int d);
+
+static void block4(G722DecoderState *s, int band, int d)
+{
+    int wd1;
+    int wd2;
+    int wd3;
+    int i;
+
+    /* Block 4, RECONS */
+    s-&gt;band[band].d[0] = d;
+    s-&gt;band[band].r[0] = saturate(s-&gt;band[band].s + d);
+
+    /* Block 4, PARREC */
+    s-&gt;band[band].p[0] = saturate(s-&gt;band[band].sz + d);
+
+    /* Block 4, UPPOL2 */
+    for (i = 0;  i &lt; 3;  i++)
+        s-&gt;band[band].sg[i] = s-&gt;band[band].p[i] &gt;&gt; 15;
+    wd1 = saturate(s-&gt;band[band].a[1] * 4);
+
+    wd2 = (s-&gt;band[band].sg[0] == s-&gt;band[band].sg[1])  ?  -wd1  :  wd1;
+    if (wd2 &gt; 32767)
+        wd2 = 32767;
+    wd3 = (s-&gt;band[band].sg[0] == s-&gt;band[band].sg[2])  ?  128  :  -128;
+    wd3 += (wd2 &gt;&gt; 7);
+    wd3 += (s-&gt;band[band].a[2]*32512) &gt;&gt; 15;
+    if (wd3 &gt; 12288)
+        wd3 = 12288;
+    else if (wd3 &lt; -12288)
+        wd3 = -12288;
+    s-&gt;band[band].ap[2] = wd3;
+
+    /* Block 4, UPPOL1 */
+    s-&gt;band[band].sg[0] = s-&gt;band[band].p[0] &gt;&gt; 15;
+    s-&gt;band[band].sg[1] = s-&gt;band[band].p[1] &gt;&gt; 15;
+    wd1 = (s-&gt;band[band].sg[0] == s-&gt;band[band].sg[1])  ?  192  :  -192;
+    wd2 = (s-&gt;band[band].a[1]*32640) &gt;&gt; 15;
+
+    s-&gt;band[band].ap[1] = saturate(wd1 + wd2);
+    wd3 = saturate(15360 - s-&gt;band[band].ap[2]);
+    if (s-&gt;band[band].ap[1] &gt; wd3)
+        s-&gt;band[band].ap[1] = wd3;
+    else if (s-&gt;band[band].ap[1] &lt; -wd3)
+        s-&gt;band[band].ap[1] = -wd3;
+
+    /* Block 4, UPZERO */
+    wd1 = (d == 0)  ?  0  :  128;
+    s-&gt;band[band].sg[0] = d &gt;&gt; 15;
+    for (i = 1;  i &lt; 7;  i++)
+    {
+        s-&gt;band[band].sg[i] = s-&gt;band[band].d[i] &gt;&gt; 15;
+        wd2 = (s-&gt;band[band].sg[i] == s-&gt;band[band].sg[0])  ?  wd1  :  -wd1;
+        wd3 = (s-&gt;band[band].b[i]*32640) &gt;&gt; 15;
+        s-&gt;band[band].bp[i] = saturate(wd2 + wd3);
+    }
+
+    /* Block 4, DELAYA */
+    for (i = 6;  i &gt; 0;  i--)
+    {
+        s-&gt;band[band].d[i] = s-&gt;band[band].d[i - 1];
+        s-&gt;band[band].b[i] = s-&gt;band[band].bp[i];
+    }
+
+    for (i = 2;  i &gt; 0;  i--)
+    {
+        s-&gt;band[band].r[i] = s-&gt;band[band].r[i - 1];
+        s-&gt;band[band].p[i] = s-&gt;band[band].p[i - 1];
+        s-&gt;band[band].a[i] = s-&gt;band[band].ap[i];
+    }
+
+    /* Block 4, FILTEP */
+    wd1 = saturate(s-&gt;band[band].r[1] + s-&gt;band[band].r[1]);
+    wd1 = (s-&gt;band[band].a[1]*wd1) &gt;&gt; 15;
+    wd2 = saturate(s-&gt;band[band].r[2] + s-&gt;band[band].r[2]);
+    wd2 = (s-&gt;band[band].a[2]*wd2) &gt;&gt; 15;
+    s-&gt;band[band].sp = saturate(wd1 + wd2);
+
+    /* Block 4, FILTEZ */
+    s-&gt;band[band].sz = 0;
+    for (i = 6;  i &gt; 0;  i--)
+    {
+        wd1 = saturate(s-&gt;band[band].d[i] + s-&gt;band[band].d[i]);
+        s-&gt;band[band].sz += (s-&gt;band[band].b[i]*wd1) &gt;&gt; 15;
+    }
+    s-&gt;band[band].sz = saturate(s-&gt;band[band].sz);
+
+    /* Block 4, PREDIC */
+    s-&gt;band[band].s = saturate(s-&gt;band[band].sp + s-&gt;band[band].sz);
+}
+/*- End of function --------------------------------------------------------*/
+
+G722DecoderState* WebRtc_g722_decode_init(G722DecoderState* s,
+                                          int rate,
+                                          int options) {
+    s = s ? s : malloc(sizeof(*s));
+    memset(s, 0, sizeof(*s));
+    if (rate == 48000)
+        s-&gt;bits_per_sample = 6;
+    else if (rate == 56000)
+        s-&gt;bits_per_sample = 7;
+    else
+        s-&gt;bits_per_sample = 8;
+    if ((options &amp; G722_SAMPLE_RATE_8000))
+        s-&gt;eight_k = TRUE;
+    if ((options &amp; G722_PACKED)  &amp;&amp;  s-&gt;bits_per_sample != 8)
+        s-&gt;packed = TRUE;
+    else
+        s-&gt;packed = FALSE;
+    s-&gt;band[0].det = 32;
+    s-&gt;band[1].det = 8;
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+int WebRtc_g722_decode_release(G722DecoderState *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+size_t WebRtc_g722_decode(G722DecoderState *s, int16_t amp[],
+                          const uint8_t g722_data[], size_t len)
+{
+    static const int wl[8] = {-60, -30, 58, 172, 334, 538, 1198, 3042 };
+    static const int rl42[16] = {0, 7, 6, 5, 4, 3, 2, 1,
+                                 7, 6, 5, 4, 3,  2, 1, 0 };
+    static const int ilb[32] =
+    {
+        2048, 2093, 2139, 2186, 2233, 2282, 2332,
+        2383, 2435, 2489, 2543, 2599, 2656, 2714,
+        2774, 2834, 2896, 2960, 3025, 3091, 3158,
+        3228, 3298, 3371, 3444, 3520, 3597, 3676,
+        3756, 3838, 3922, 4008
+    };
+    static const int wh[3] = {0, -214, 798};
+    static const int rh2[4] = {2, 1, 2, 1};
+    static const int qm2[4] = {-7408, -1616,  7408,   1616};
+    static const int qm4[16] =
+    {
+              0, -20456, -12896,  -8968,
+          -6288,  -4240,  -2584,  -1200,
+          20456,  12896,   8968,   6288,
+           4240,   2584,   1200,      0
+    };
+    static const int qm5[32] =
+    {
+           -280,   -280, -23352, -17560,
+         -14120, -11664,  -9752,  -8184,
+          -6864,  -5712,  -4696,  -3784,
+          -2960,  -2208,  -1520,   -880,
+          23352,  17560,  14120,  11664,
+           9752,   8184,   6864,   5712,
+           4696,   3784,   2960,   2208,
+           1520,    880,    280,   -280
+    };
+    static const int qm6[64] =
+    {
+           -136,   -136,   -136,   -136,
+         -24808, -21904, -19008, -16704,
+         -14984, -13512, -12280, -11192,
+         -10232,  -9360,  -8576,  -7856,
+          -7192,  -6576,  -6000,  -5456,
+          -4944,  -4464,  -4008,  -3576,
+          -3168,  -2776,  -2400,  -2032,
+          -1688,  -1360,  -1040,   -728,
+          24808,  21904,  19008,  16704,
+          14984,  13512,  12280,  11192,
+          10232,   9360,   8576,   7856,
+           7192,   6576,   6000,   5456,
+           4944,   4464,   4008,   3576,
+           3168,   2776,   2400,   2032,
+           1688,   1360,   1040,    728,
+            432,    136,   -432,   -136
+    };
+    static const int qmf_coeffs[12] =
+    {
+           3,  -11,   12,   32, -210,  951, 3876, -805,  362, -156,   53,  -11,
+    };
+
+    int dlowt;
+    int rlow;
+    int ihigh;
+    int dhigh;
+    int rhigh;
+    int xout1;
+    int xout2;
+    int wd1;
+    int wd2;
+    int wd3;
+    int code;
+    size_t outlen;
+    int i;
+    size_t j;
+
+    outlen = 0;
+    rhigh = 0;
+    for (j = 0;  j &lt; len;  )
+    {
+        if (s-&gt;packed)
+        {
+            /* Unpack the code bits */
+            if (s-&gt;in_bits &lt; s-&gt;bits_per_sample)
+            {
+                s-&gt;in_buffer |= (g722_data[j++] &lt;&lt; s-&gt;in_bits);
+                s-&gt;in_bits += 8;
+            }
+            code = s-&gt;in_buffer &amp; ((1 &lt;&lt; s-&gt;bits_per_sample) - 1);
+            s-&gt;in_buffer &gt;&gt;= s-&gt;bits_per_sample;
+            s-&gt;in_bits -= s-&gt;bits_per_sample;
+        }
+        else
+        {
+            code = g722_data[j++];
+        }
+
+        switch (s-&gt;bits_per_sample)
+        {
+        default:
+        case 8:
+            wd1 = code &amp; 0x3F;
+            ihigh = (code &gt;&gt; 6) &amp; 0x03;
+            wd2 = qm6[wd1];
+            wd1 &gt;&gt;= 2;
+            break;
+        case 7:
+            wd1 = code &amp; 0x1F;
+            ihigh = (code &gt;&gt; 5) &amp; 0x03;
+            wd2 = qm5[wd1];
+            wd1 &gt;&gt;= 1;
+            break;
+        case 6:
+            wd1 = code &amp; 0x0F;
+            ihigh = (code &gt;&gt; 4) &amp; 0x03;
+            wd2 = qm4[wd1];
+            break;
+        }
+        /* Block 5L, LOW BAND INVQBL */
+        wd2 = (s-&gt;band[0].det*wd2) &gt;&gt; 15;
+        /* Block 5L, RECONS */
+        rlow = s-&gt;band[0].s + wd2;
+        /* Block 6L, LIMIT */
+        if (rlow &gt; 16383)
+            rlow = 16383;
+        else if (rlow &lt; -16384)
+            rlow = -16384;
+
+        /* Block 2L, INVQAL */
+        wd2 = qm4[wd1];
+        dlowt = (s-&gt;band[0].det*wd2) &gt;&gt; 15;
+
+        /* Block 3L, LOGSCL */
+        wd2 = rl42[wd1];
+        wd1 = (s-&gt;band[0].nb*127) &gt;&gt; 7;
+        wd1 += wl[wd2];
+        if (wd1 &lt; 0)
+            wd1 = 0;
+        else if (wd1 &gt; 18432)
+            wd1 = 18432;
+        s-&gt;band[0].nb = wd1;
+
+        /* Block 3L, SCALEL */
+        wd1 = (s-&gt;band[0].nb &gt;&gt; 6) &amp; 31;
+        wd2 = 8 - (s-&gt;band[0].nb &gt;&gt; 11);
+        wd3 = (wd2 &lt; 0)  ?  (ilb[wd1] &lt;&lt; -wd2)  :  (ilb[wd1] &gt;&gt; wd2);
+        s-&gt;band[0].det = wd3 &lt;&lt; 2;
+
+        block4(s, 0, dlowt);
+
+        if (!s-&gt;eight_k)
+        {
+            /* Block 2H, INVQAH */
+            wd2 = qm2[ihigh];
+            dhigh = (s-&gt;band[1].det*wd2) &gt;&gt; 15;
+            /* Block 5H, RECONS */
+            rhigh = dhigh + s-&gt;band[1].s;
+            /* Block 6H, LIMIT */
+            if (rhigh &gt; 16383)
+                rhigh = 16383;
+            else if (rhigh &lt; -16384)
+                rhigh = -16384;
+
+            /* Block 2H, INVQAH */
+            wd2 = rh2[ihigh];
+            wd1 = (s-&gt;band[1].nb*127) &gt;&gt; 7;
+            wd1 += wh[wd2];
+            if (wd1 &lt; 0)
+                wd1 = 0;
+            else if (wd1 &gt; 22528)
+                wd1 = 22528;
+            s-&gt;band[1].nb = wd1;
+
+            /* Block 3H, SCALEH */
+            wd1 = (s-&gt;band[1].nb &gt;&gt; 6) &amp; 31;
+            wd2 = 10 - (s-&gt;band[1].nb &gt;&gt; 11);
+            wd3 = (wd2 &lt; 0)  ?  (ilb[wd1] &lt;&lt; -wd2)  :  (ilb[wd1] &gt;&gt; wd2);
+            s-&gt;band[1].det = wd3 &lt;&lt; 2;
+
+            block4(s, 1, dhigh);
+        }
+
+        if (s-&gt;itu_test_mode)
+        {
+            amp[outlen++] = (int16_t) (rlow &lt;&lt; 1);
+            amp[outlen++] = (int16_t) (rhigh &lt;&lt; 1);
+        }
+        else
+        {
+            if (s-&gt;eight_k)
+            {
+                amp[outlen++] = (int16_t) (rlow &lt;&lt; 1);
+            }
+            else
+            {
+                /* Apply the receive QMF */
+                for (i = 0;  i &lt; 22;  i++)
+                    s-&gt;x[i] = s-&gt;x[i + 2];
+                s-&gt;x[22] = rlow + rhigh;
+                s-&gt;x[23] = rlow - rhigh;
+
+                xout1 = 0;
+                xout2 = 0;
+                for (i = 0;  i &lt; 12;  i++)
+                {
+                    xout2 += s-&gt;x[2*i]*qmf_coeffs[i];
+                    xout1 += s-&gt;x[2*i + 1]*qmf_coeffs[11 - i];
+                }
+                /* We shift by 12 to allow for the QMF filters (DC gain = 4096), less 1
+                   to allow for the 15 bit input to the G.722 algorithm. */
+                /* WebRtc, tlegrand: added saturation */
+                amp[outlen++] = saturate(xout1 &gt;&gt; 11);
+                amp[outlen++] = saturate(xout2 &gt;&gt; 11);
+            }
+        }
+    }
+    return outlen;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_enc_dech"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_enc_dec.h (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_enc_dec.h                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_enc_dec.h        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,160 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * g722.h - The ITU G.722 codec.
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ *  Despite my general liking of the GPL, I place my own contributions 
+ *  to this code in the public domain for the benefit of all mankind -
+ *  even the slimy ones who might try to proprietize my work and use it
+ *  to my detriment.
+ *
+ * Based on a single channel G.722 codec which is:
+ *
+ *****    Copyright (c) CMU    1993      *****
+ * Computer Science, Speech Group
+ * Chengxiang Lu and Alex Hauptmann
+ *
+ * $Id: g722.h,v 1.10 2006/06/16 12:45:53 steveu Exp $
+ *
+ * Modifications for WebRtc, 2011/04/28, by tlegrand:
+ * -Changed to use WebRtc types
+ * -Added new defines for minimum and maximum values of short int
+ */
+
+
+/*! \file */
+
+#if !defined(_G722_ENC_DEC_H_)
+#define _G722_ENC_DEC_H_
+
+#include &quot;webrtc/typedefs.h&quot;
+
+/*! \page g722_page G.722 encoding and decoding
+\section g722_page_sec_1 What does it do?
+The G.722 module is a bit exact implementation of the ITU G.722 specification for all three
+specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests.
+
+To allow fast and flexible interworking with narrow band telephony, the encoder and decoder
+support an option for the linear audio to be an 8k samples/second stream. In this mode the
+codec is considerably faster, and still fully compatible with wideband terminals using G.722.
+
+\section g722_page_sec_2 How does it work?
+???.
+*/
+
+#define WEBRTC_INT16_MAX 32767
+#define WEBRTC_INT16_MIN -32768
+
+enum
+{
+    G722_SAMPLE_RATE_8000 = 0x0001,
+    G722_PACKED = 0x0002
+};
+
+typedef struct
+{
+    /*! TRUE if the operating in the special ITU test mode, with the band split filters
+             disabled. */
+    int itu_test_mode;
+    /*! TRUE if the G.722 data is packed */
+    int packed;
+    /*! TRUE if encode from 8k samples/second */
+    int eight_k;
+    /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
+    int bits_per_sample;
+
+    /*! Signal history for the QMF */
+    int x[24];
+
+    struct
+    {
+        int s;
+        int sp;
+        int sz;
+        int r[3];
+        int a[3];
+        int ap[3];
+        int p[3];
+        int d[7];
+        int b[7];
+        int bp[7];
+        int sg[7];
+        int nb;
+        int det;
+    } band[2];
+
+    unsigned int in_buffer;
+    int in_bits;
+    unsigned int out_buffer;
+    int out_bits;
+} G722EncoderState;
+
+typedef struct
+{
+    /*! TRUE if the operating in the special ITU test mode, with the band split filters
+             disabled. */
+    int itu_test_mode;
+    /*! TRUE if the G.722 data is packed */
+    int packed;
+    /*! TRUE if decode to 8k samples/second */
+    int eight_k;
+    /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
+    int bits_per_sample;
+
+    /*! Signal history for the QMF */
+    int x[24];
+
+    struct
+    {
+        int s;
+        int sp;
+        int sz;
+        int r[3];
+        int a[3];
+        int ap[3];
+        int p[3];
+        int d[7];
+        int b[7];
+        int bp[7];
+        int sg[7];
+        int nb;
+        int det;
+    } band[2];
+    
+    unsigned int in_buffer;
+    int in_bits;
+    unsigned int out_buffer;
+    int out_bits;
+} G722DecoderState;
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
+G722EncoderState* WebRtc_g722_encode_init(G722EncoderState* s,
+                                          int rate,
+                                          int options);
+int WebRtc_g722_encode_release(G722EncoderState *s);
+size_t WebRtc_g722_encode(G722EncoderState *s,
+                          uint8_t g722_data[],
+                          const int16_t amp[],
+                          size_t len);
+
+G722DecoderState* WebRtc_g722_decode_init(G722DecoderState* s,
+                                          int rate,
+                                          int options);
+int WebRtc_g722_decode_release(G722DecoderState *s);
+size_t WebRtc_g722_decode(G722DecoderState *s,
+                          int16_t amp[],
+                          const uint8_t g722_data[],
+                          size_t len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_encodec"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_encode.c (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_encode.c                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_encode.c        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,430 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * g722_encode.c - The ITU G.722 codec, encode part.
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2005 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ *  Despite my general liking of the GPL, I place my own contributions
+ *  to this code in the public domain for the benefit of all mankind -
+ *  even the slimy ones who might try to proprietize my work and use it
+ *  to my detriment.
+ *
+ * Based on a single channel 64kbps only G.722 codec which is:
+ *
+ *****    Copyright (c) CMU    1993      *****
+ * Computer Science, Speech Group
+ * Chengxiang Lu and Alex Hauptmann
+ *
+ * $Id: g722_encode.c,v 1.14 2006/07/07 16:37:49 steveu Exp $
+ *
+ * Modifications for WebRtc, 2011/04/28, by tlegrand:
+ * -Removed usage of inttypes.h and tgmath.h
+ * -Changed to use WebRtc types
+ * -Added option to run encoder bitexact with ITU-T reference implementation
+ */
+
+/*! \file */
+
+#include &lt;memory.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+
+#include &quot;g722_enc_dec.h&quot;
+#include &quot;webrtc/typedefs.h&quot;
+
+#if !defined(FALSE)
+#define FALSE 0
+#endif
+#if !defined(TRUE)
+#define TRUE (!FALSE)
+#endif
+
+static __inline int16_t saturate(int32_t amp)
+{
+    int16_t amp16;
+
+    /* Hopefully this is optimised for the common case - not clipping */
+    amp16 = (int16_t) amp;
+    if (amp == amp16)
+        return amp16;
+    if (amp &gt; WEBRTC_INT16_MAX)
+        return  WEBRTC_INT16_MAX;
+    return  WEBRTC_INT16_MIN;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void block4(G722EncoderState *s, int band, int d)
+{
+    int wd1;
+    int wd2;
+    int wd3;
+    int i;
+
+    /* Block 4, RECONS */
+    s-&gt;band[band].d[0] = d;
+    s-&gt;band[band].r[0] = saturate(s-&gt;band[band].s + d);
+
+    /* Block 4, PARREC */
+    s-&gt;band[band].p[0] = saturate(s-&gt;band[band].sz + d);
+
+    /* Block 4, UPPOL2 */
+    for (i = 0;  i &lt; 3;  i++)
+        s-&gt;band[band].sg[i] = s-&gt;band[band].p[i] &gt;&gt; 15;
+    wd1 = saturate(s-&gt;band[band].a[1] &lt;&lt; 2);
+
+    wd2 = (s-&gt;band[band].sg[0] == s-&gt;band[band].sg[1])  ?  -wd1  :  wd1;
+    if (wd2 &gt; 32767)
+        wd2 = 32767;
+    wd3 = (wd2 &gt;&gt; 7) + ((s-&gt;band[band].sg[0] == s-&gt;band[band].sg[2])  ?  128  :  -128);
+    wd3 += (s-&gt;band[band].a[2]*32512) &gt;&gt; 15;
+    if (wd3 &gt; 12288)
+        wd3 = 12288;
+    else if (wd3 &lt; -12288)
+        wd3 = -12288;
+    s-&gt;band[band].ap[2] = wd3;
+
+    /* Block 4, UPPOL1 */
+    s-&gt;band[band].sg[0] = s-&gt;band[band].p[0] &gt;&gt; 15;
+    s-&gt;band[band].sg[1] = s-&gt;band[band].p[1] &gt;&gt; 15;
+    wd1 = (s-&gt;band[band].sg[0] == s-&gt;band[band].sg[1])  ?  192  :  -192;
+    wd2 = (s-&gt;band[band].a[1]*32640) &gt;&gt; 15;
+
+    s-&gt;band[band].ap[1] = saturate(wd1 + wd2);
+    wd3 = saturate(15360 - s-&gt;band[band].ap[2]);
+    if (s-&gt;band[band].ap[1] &gt; wd3)
+        s-&gt;band[band].ap[1] = wd3;
+    else if (s-&gt;band[band].ap[1] &lt; -wd3)
+        s-&gt;band[band].ap[1] = -wd3;
+
+    /* Block 4, UPZERO */
+    wd1 = (d == 0)  ?  0  :  128;
+    s-&gt;band[band].sg[0] = d &gt;&gt; 15;
+    for (i = 1;  i &lt; 7;  i++)
+    {
+        s-&gt;band[band].sg[i] = s-&gt;band[band].d[i] &gt;&gt; 15;
+        wd2 = (s-&gt;band[band].sg[i] == s-&gt;band[band].sg[0])  ?  wd1  :  -wd1;
+        wd3 = (s-&gt;band[band].b[i]*32640) &gt;&gt; 15;
+        s-&gt;band[band].bp[i] = saturate(wd2 + wd3);
+    }
+
+    /* Block 4, DELAYA */
+    for (i = 6;  i &gt; 0;  i--)
+    {
+        s-&gt;band[band].d[i] = s-&gt;band[band].d[i - 1];
+        s-&gt;band[band].b[i] = s-&gt;band[band].bp[i];
+    }
+
+    for (i = 2;  i &gt; 0;  i--)
+    {
+        s-&gt;band[band].r[i] = s-&gt;band[band].r[i - 1];
+        s-&gt;band[band].p[i] = s-&gt;band[band].p[i - 1];
+        s-&gt;band[band].a[i] = s-&gt;band[band].ap[i];
+    }
+
+    /* Block 4, FILTEP */
+    wd1 = saturate(s-&gt;band[band].r[1] + s-&gt;band[band].r[1]);
+    wd1 = (s-&gt;band[band].a[1]*wd1) &gt;&gt; 15;
+    wd2 = saturate(s-&gt;band[band].r[2] + s-&gt;band[band].r[2]);
+    wd2 = (s-&gt;band[band].a[2]*wd2) &gt;&gt; 15;
+    s-&gt;band[band].sp = saturate(wd1 + wd2);
+
+    /* Block 4, FILTEZ */
+    s-&gt;band[band].sz = 0;
+    for (i = 6;  i &gt; 0;  i--)
+    {
+        wd1 = saturate(s-&gt;band[band].d[i] + s-&gt;band[band].d[i]);
+        s-&gt;band[band].sz += (s-&gt;band[band].b[i]*wd1) &gt;&gt; 15;
+    }
+    s-&gt;band[band].sz = saturate(s-&gt;band[band].sz);
+
+    /* Block 4, PREDIC */
+    s-&gt;band[band].s = saturate(s-&gt;band[band].sp + s-&gt;band[band].sz);
+}
+/*- End of function --------------------------------------------------------*/
+
+G722EncoderState* WebRtc_g722_encode_init(G722EncoderState* s,
+                                          int rate,
+                                          int options) {
+    if (s == NULL)
+    {
+        if ((s = (G722EncoderState *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));
+    if (rate == 48000)
+        s-&gt;bits_per_sample = 6;
+    else if (rate == 56000)
+        s-&gt;bits_per_sample = 7;
+    else
+        s-&gt;bits_per_sample = 8;
+    if ((options &amp; G722_SAMPLE_RATE_8000))
+        s-&gt;eight_k = TRUE;
+    if ((options &amp; G722_PACKED)  &amp;&amp;  s-&gt;bits_per_sample != 8)
+        s-&gt;packed = TRUE;
+    else
+        s-&gt;packed = FALSE;
+    s-&gt;band[0].det = 32;
+    s-&gt;band[1].det = 8;
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+int WebRtc_g722_encode_release(G722EncoderState *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+/* WebRtc, tlegrand:
+ * Only define the following if bit-exactness with reference implementation
+ * is needed. Will only have any effect if input signal is saturated.
+ */
+//#define RUN_LIKE_REFERENCE_G722
+#ifdef RUN_LIKE_REFERENCE_G722
+int16_t limitValues (int16_t rl)
+{
+
+    int16_t yl;
+
+    yl = (rl &gt; 16383) ? 16383 : ((rl &lt; -16384) ? -16384 : rl);
+
+    return (yl);
+}
+#endif
+
+size_t WebRtc_g722_encode(G722EncoderState *s, uint8_t g722_data[],
+                          const int16_t amp[], size_t len)
+{
+    static const int q6[32] =
+    {
+           0,   35,   72,  110,  150,  190,  233,  276,
+         323,  370,  422,  473,  530,  587,  650,  714,
+         786,  858,  940, 1023, 1121, 1219, 1339, 1458,
+        1612, 1765, 1980, 2195, 2557, 2919,    0,    0
+    };
+    static const int iln[32] =
+    {
+         0, 63, 62, 31, 30, 29, 28, 27,
+        26, 25, 24, 23, 22, 21, 20, 19,
+        18, 17, 16, 15, 14, 13, 12, 11,
+        10,  9,  8,  7,  6,  5,  4,  0
+    };
+    static const int ilp[32] =
+    {
+         0, 61, 60, 59, 58, 57, 56, 55,
+        54, 53, 52, 51, 50, 49, 48, 47,
+        46, 45, 44, 43, 42, 41, 40, 39,
+        38, 37, 36, 35, 34, 33, 32,  0
+    };
+    static const int wl[8] =
+    {
+        -60, -30, 58, 172, 334, 538, 1198, 3042
+    };
+    static const int rl42[16] =
+    {
+        0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0
+    };
+    static const int ilb[32] =
+    {
+        2048, 2093, 2139, 2186, 2233, 2282, 2332,
+        2383, 2435, 2489, 2543, 2599, 2656, 2714,
+        2774, 2834, 2896, 2960, 3025, 3091, 3158,
+        3228, 3298, 3371, 3444, 3520, 3597, 3676,
+        3756, 3838, 3922, 4008
+    };
+    static const int qm4[16] =
+    {
+             0, -20456, -12896, -8968,
+         -6288,  -4240,  -2584, -1200,
+         20456,  12896,   8968,  6288,
+          4240,   2584,   1200,     0
+    };
+    static const int qm2[4] =
+    {
+        -7408,  -1616,   7408,   1616
+    };
+    static const int qmf_coeffs[12] =
+    {
+           3,  -11,   12,   32, -210,  951, 3876, -805,  362, -156,   53,  -11,
+    };
+    static const int ihn[3] = {0, 1, 0};
+    static const int ihp[3] = {0, 3, 2};
+    static const int wh[3] = {0, -214, 798};
+    static const int rh2[4] = {2, 1, 2, 1};
+
+    int dlow;
+    int dhigh;
+    int el;
+    int wd;
+    int wd1;
+    int ril;
+    int wd2;
+    int il4;
+    int ih2;
+    int wd3;
+    int eh;
+    int mih;
+    int i;
+    size_t j;
+    /* Low and high band PCM from the QMF */
+    int xlow;
+    int xhigh;
+    size_t g722_bytes;
+    /* Even and odd tap accumulators */
+    int sumeven;
+    int sumodd;
+    int ihigh;
+    int ilow;
+    int code;
+
+    g722_bytes = 0;
+    xhigh = 0;
+    for (j = 0;  j &lt; len;  )
+    {
+        if (s-&gt;itu_test_mode)
+        {
+            xlow =
+            xhigh = amp[j++] &gt;&gt; 1;
+        }
+        else
+        {
+            if (s-&gt;eight_k)
+            {
+                /* We shift by 1 to allow for the 15 bit input to the G.722 algorithm. */
+                xlow = amp[j++] &gt;&gt; 1;
+            }
+            else
+            {
+                /* Apply the transmit QMF */
+                /* Shuffle the buffer down */
+                for (i = 0;  i &lt; 22;  i++)
+                    s-&gt;x[i] = s-&gt;x[i + 2];
+                s-&gt;x[22] = amp[j++];
+                s-&gt;x[23] = amp[j++];
+
+                /* Discard every other QMF output */
+                sumeven = 0;
+                sumodd = 0;
+                for (i = 0;  i &lt; 12;  i++)
+                {
+                    sumodd += s-&gt;x[2*i]*qmf_coeffs[i];
+                    sumeven += s-&gt;x[2*i + 1]*qmf_coeffs[11 - i];
+                }
+                /* We shift by 12 to allow for the QMF filters (DC gain = 4096), plus 1
+                   to allow for us summing two filters, plus 1 to allow for the 15 bit
+                   input to the G.722 algorithm. */
+                xlow = (sumeven + sumodd) &gt;&gt; 14;
+                xhigh = (sumeven - sumodd) &gt;&gt; 14;
+
+#ifdef RUN_LIKE_REFERENCE_G722
+                /* The following lines are only used to verify bit-exactness
+                 * with reference implementation of G.722. Higher precision
+                 * is achieved without limiting the values.
+                 */
+                xlow = limitValues(xlow);
+                xhigh = limitValues(xhigh);
+#endif
+            }
+        }
+        /* Block 1L, SUBTRA */
+        el = saturate(xlow - s-&gt;band[0].s);
+
+        /* Block 1L, QUANTL */
+        wd = (el &gt;= 0)  ?  el  :  -(el + 1);
+
+        for (i = 1;  i &lt; 30;  i++)
+        {
+            wd1 = (q6[i]*s-&gt;band[0].det) &gt;&gt; 12;
+            if (wd &lt; wd1)
+                break;
+        }
+        ilow = (el &lt; 0)  ?  iln[i]  :  ilp[i];
+
+        /* Block 2L, INVQAL */
+        ril = ilow &gt;&gt; 2;
+        wd2 = qm4[ril];
+        dlow = (s-&gt;band[0].det*wd2) &gt;&gt; 15;
+
+        /* Block 3L, LOGSCL */
+        il4 = rl42[ril];
+        wd = (s-&gt;band[0].nb*127) &gt;&gt; 7;
+        s-&gt;band[0].nb = wd + wl[il4];
+        if (s-&gt;band[0].nb &lt; 0)
+            s-&gt;band[0].nb = 0;
+        else if (s-&gt;band[0].nb &gt; 18432)
+            s-&gt;band[0].nb = 18432;
+
+        /* Block 3L, SCALEL */
+        wd1 = (s-&gt;band[0].nb &gt;&gt; 6) &amp; 31;
+        wd2 = 8 - (s-&gt;band[0].nb &gt;&gt; 11);
+        wd3 = (wd2 &lt; 0)  ?  (ilb[wd1] &lt;&lt; -wd2)  :  (ilb[wd1] &gt;&gt; wd2);
+        s-&gt;band[0].det = wd3 &lt;&lt; 2;
+
+        block4(s, 0, dlow);
+
+        if (s-&gt;eight_k)
+        {
+            /* Just leave the high bits as zero */
+            code = (0xC0 | ilow) &gt;&gt; (8 - s-&gt;bits_per_sample);
+        }
+        else
+        {
+            /* Block 1H, SUBTRA */
+            eh = saturate(xhigh - s-&gt;band[1].s);
+
+            /* Block 1H, QUANTH */
+            wd = (eh &gt;= 0)  ?  eh  :  -(eh + 1);
+            wd1 = (564*s-&gt;band[1].det) &gt;&gt; 12;
+            mih = (wd &gt;= wd1)  ?  2  :  1;
+            ihigh = (eh &lt; 0)  ?  ihn[mih]  :  ihp[mih];
+
+            /* Block 2H, INVQAH */
+            wd2 = qm2[ihigh];
+            dhigh = (s-&gt;band[1].det*wd2) &gt;&gt; 15;
+
+            /* Block 3H, LOGSCH */
+            ih2 = rh2[ihigh];
+            wd = (s-&gt;band[1].nb*127) &gt;&gt; 7;
+            s-&gt;band[1].nb = wd + wh[ih2];
+            if (s-&gt;band[1].nb &lt; 0)
+                s-&gt;band[1].nb = 0;
+            else if (s-&gt;band[1].nb &gt; 22528)
+                s-&gt;band[1].nb = 22528;
+
+            /* Block 3H, SCALEH */
+            wd1 = (s-&gt;band[1].nb &gt;&gt; 6) &amp; 31;
+            wd2 = 10 - (s-&gt;band[1].nb &gt;&gt; 11);
+            wd3 = (wd2 &lt; 0)  ?  (ilb[wd1] &lt;&lt; -wd2)  :  (ilb[wd1] &gt;&gt; wd2);
+            s-&gt;band[1].det = wd3 &lt;&lt; 2;
+
+            block4(s, 1, dhigh);
+            code = ((ihigh &lt;&lt; 6) | ilow) &gt;&gt; (8 - s-&gt;bits_per_sample);
+        }
+
+        if (s-&gt;packed)
+        {
+            /* Pack the code bits */
+            s-&gt;out_buffer |= (code &lt;&lt; s-&gt;out_bits);
+            s-&gt;out_bits += s-&gt;bits_per_sample;
+            if (s-&gt;out_bits &gt;= 8)
+            {
+                g722_data[g722_bytes++] = (uint8_t) (s-&gt;out_buffer &amp; 0xFF);
+                s-&gt;out_bits -= 8;
+                s-&gt;out_buffer &gt;&gt;= 8;
+            }
+        }
+        else
+        {
+            g722_data[g722_bytes++] = (uint8_t) code;
+        }
+    }
+    return g722_bytes;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_interfacec"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.c (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.c                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.c        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+/*
+ *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+
+
+#include &lt;stdlib.h&gt;
+#include &lt;string.h&gt;
+#include &quot;g722_enc_dec.h&quot;
+#include &quot;g722_interface.h&quot;
+#include &quot;webrtc/typedefs.h&quot;
+
+int16_t WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst)
+{
+    *G722enc_inst=(G722EncInst*)malloc(sizeof(G722EncoderState));
+    if (*G722enc_inst!=NULL) {
+      return(0);
+    } else {
+      return(-1);
+    }
+}
+
+int16_t WebRtcG722_EncoderInit(G722EncInst *G722enc_inst)
+{
+    // Create and/or reset the G.722 encoder
+    // Bitrate 64 kbps and wideband mode (2)
+    G722enc_inst = (G722EncInst *) WebRtc_g722_encode_init(
+        (G722EncoderState*) G722enc_inst, 64000, 2);
+    if (G722enc_inst == NULL) {
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst)
+{
+    // Free encoder memory
+    return WebRtc_g722_encode_release((G722EncoderState*) G722enc_inst);
+}
+
+size_t WebRtcG722_Encode(G722EncInst *G722enc_inst,
+                         const int16_t* speechIn,
+                         size_t len,
+                         uint8_t* encoded)
+{
+    unsigned char *codechar = (unsigned char*) encoded;
+    // Encode the input speech vector
+    return WebRtc_g722_encode((G722EncoderState*) G722enc_inst, codechar,
+                              speechIn, len);
+}
+
+int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst)
+{
+    *G722dec_inst=(G722DecInst*)malloc(sizeof(G722DecoderState));
+    if (*G722dec_inst!=NULL) {
+      return(0);
+    } else {
+      return(-1);
+    }
+}
+
+void WebRtcG722_DecoderInit(G722DecInst* inst) {
+  // Create and/or reset the G.722 decoder
+  // Bitrate 64 kbps and wideband mode (2)
+  WebRtc_g722_decode_init((G722DecoderState*)inst, 64000, 2);
+}
+
+int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst)
+{
+    // Free encoder memory
+    return WebRtc_g722_decode_release((G722DecoderState*) G722dec_inst);
+}
+
+size_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
+                         const uint8_t *encoded,
+                         size_t len,
+                         int16_t *decoded,
+                         int16_t *speechType)
+{
+    // Decode the G.722 encoder stream
+    *speechType=G722_WEBRTC_SPEECH;
+    return WebRtc_g722_decode((G722DecoderState*) G722dec_inst, decoded,
+                              encoded, len);
+}
+
+int16_t WebRtcG722_Version(char *versionStr, short len)
+{
+    // Get version string
+    char version[30] = &quot;2.0.0\n&quot;;
+    if (strlen(version) &lt; (unsigned int)len)
+    {
+        strcpy(versionStr, version);
+        return 0;
+    }
+    else
+    {
+        return -1;
+    }
+}
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722g722_interfaceh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.h (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.h                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/g722_interface.h        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,182 @@
</span><ins>+/*
+ *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_G722_INTERFACE_H_
+#define WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_G722_INTERFACE_H_
+
+#include &quot;webrtc/typedefs.h&quot;
+
+/*
+ * Solution to support multiple instances
+ */
+
+typedef struct WebRtcG722EncInst    G722EncInst;
+typedef struct WebRtcG722DecInst    G722DecInst;
+
+/*
+ * Comfort noise constants
+ */
+
+#define G722_WEBRTC_SPEECH     1
+#define G722_WEBRTC_CNG        2
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
+
+/****************************************************************************
+ * WebRtcG722_CreateEncoder(...)
+ *
+ * Create memory used for G722 encoder
+ *
+ * Input:
+ *     - G722enc_inst         : G722 instance for encoder
+ *
+ * Return value               :  0 - Ok
+ *                              -1 - Error
+ */
+int16_t WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst);
+
+
+/****************************************************************************
+ * WebRtcG722_EncoderInit(...)
+ *
+ * This function initializes a G722 instance
+ *
+ * Input:
+ *     - G722enc_inst         : G722 instance, i.e. the user that should receive
+ *                             be initialized
+ *
+ * Return value               :  0 - Ok
+ *                              -1 - Error
+ */
+
+int16_t WebRtcG722_EncoderInit(G722EncInst *G722enc_inst);
+
+
+/****************************************************************************
+ * WebRtcG722_FreeEncoder(...)
+ *
+ * Free the memory used for G722 encoder
+ *
+ * Input:
+ *     - G722enc_inst         : G722 instance for encoder
+ *
+ * Return value               :  0 - Ok
+ *                              -1 - Error
+ */
+int WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst);
+
+
+
+/****************************************************************************
+ * WebRtcG722_Encode(...)
+ *
+ * This function encodes G722 encoded data.
+ *
+ * Input:
+ *     - G722enc_inst         : G722 instance, i.e. the user that should encode
+ *                              a packet
+ *     - speechIn             : Input speech vector
+ *     - len                  : Samples in speechIn
+ *
+ * Output:
+ *        - encoded           : The encoded data vector
+ *
+ * Return value               : Length (in bytes) of coded data
+ */
+
+size_t WebRtcG722_Encode(G722EncInst* G722enc_inst,
+                         const int16_t* speechIn,
+                         size_t len,
+                         uint8_t* encoded);
+
+
+/****************************************************************************
+ * WebRtcG722_CreateDecoder(...)
+ *
+ * Create memory used for G722 encoder
+ *
+ * Input:
+ *     - G722dec_inst         : G722 instance for decoder
+ *
+ * Return value               :  0 - Ok
+ *                              -1 - Error
+ */
+int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst);
+
+/****************************************************************************
+ * WebRtcG722_DecoderInit(...)
+ *
+ * This function initializes a G722 instance
+ *
+ * Input:
+ *     - inst      : G722 instance
+ */
+
+void WebRtcG722_DecoderInit(G722DecInst* inst);
+
+/****************************************************************************
+ * WebRtcG722_FreeDecoder(...)
+ *
+ * Free the memory used for G722 decoder
+ *
+ * Input:
+ *     - G722dec_inst         : G722 instance for decoder
+ *
+ * Return value               :  0 - Ok
+ *                              -1 - Error
+ */
+
+int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst);
+
+
+/****************************************************************************
+ * WebRtcG722_Decode(...)
+ *
+ * This function decodes a packet with G729 frame(s). Output speech length
+ * will be a multiple of 80 samples (80*frames/packet).
+ *
+ * Input:
+ *     - G722dec_inst       : G722 instance, i.e. the user that should decode
+ *                            a packet
+ *     - encoded            : Encoded G722 frame(s)
+ *     - len                : Bytes in encoded vector
+ *
+ * Output:
+ *        - decoded         : The decoded vector
+ *      - speechType        : 1 normal, 2 CNG (Since G722 does not have its own
+ *                            DTX/CNG scheme it should always return 1)
+ *
+ * Return value             : Samples in decoded vector
+ */
+
+size_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
+                         const uint8_t* encoded,
+                         size_t len,
+                         int16_t *decoded,
+                         int16_t *speechType);
+
+/****************************************************************************
+ * WebRtcG722_Version(...)
+ *
+ * Get a string with the current version of the codec
+ */
+
+int16_t WebRtcG722_Version(char *versionStr, short len);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_G722_INTERFACE_H_ */
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtcSourcewebrtcmodulesaudio_codingcodecsg722testtestG722cc"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc (0 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc                                (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/g722/test/testG722.cc        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -0,0 +1,158 @@
</span><ins>+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+/*
+ * testG722.cpp : Defines the entry point for the console application.
+ */
+
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;string.h&gt;
+#include &quot;webrtc/typedefs.h&quot;
+
+/* include API */
+#include &quot;webrtc/modules/audio_coding/codecs/g722/g722_interface.h&quot;
+
+/* Runtime statistics */
+#include &lt;time.h&gt;
+#define CLOCKS_PER_SEC_G722  100000
+
+// Forward declaration
+typedef struct WebRtcG722EncInst    G722EncInst;
+typedef struct WebRtcG722DecInst    G722DecInst;
+
+/* function for reading audio data from PCM file */
+bool readframe(int16_t *data, FILE *inp, size_t length)
+{
+    size_t rlen = fread(data, sizeof(int16_t), length, inp);
+    if (rlen &gt;= length)
+      return false;
+    memset(data + rlen, 0, (length - rlen) * sizeof(int16_t));
+    return true;
+}
+
+int main(int argc, char* argv[])
+{
+    char inname[60], outbit[40], outname[40];
+    FILE *inp, *outbitp, *outp;
+
+    int framecnt;
+    bool endfile;
+    size_t framelength = 160;
+    G722EncInst *G722enc_inst;
+    G722DecInst *G722dec_inst;
+
+    /* Runtime statistics */
+    double starttime;
+    double runtime = 0;
+    double length_file;
+
+    size_t stream_len = 0;
+    int16_t shortdata[960];
+    int16_t decoded[960];
+    uint8_t streamdata[80 * 6];
+    int16_t speechType[1];
+
+    /* handling wrong input arguments in the command line */
+    if (argc!=5)  {
+        printf(&quot;\n\nWrong number of arguments or flag values.\n\n&quot;);
+
+        printf(&quot;\n&quot;);
+        printf(&quot;Usage:\n\n&quot;);
+        printf(&quot;./testG722.exe framelength infile outbitfile outspeechfile \n\n&quot;);
+        printf(&quot;with:\n&quot;);
+        printf(&quot;framelength  :    Framelength in samples.\n\n&quot;);
+        printf(&quot;infile       :    Normal speech input file\n\n&quot;);
+        printf(&quot;outbitfile   :    Bitstream output file\n\n&quot;);
+        printf(&quot;outspeechfile:    Speech output file\n\n&quot;);
+        exit(0);
+
+    }
+
+    /* Get frame length */
+    int framelength_int = atoi(argv[1]);
+    if (framelength_int &lt; 0) {
+        printf(&quot;  G.722: Invalid framelength %d.\n&quot;, framelength_int);
+        exit(1);
+    }
+    framelength = static_cast&lt;size_t&gt;(framelength_int);
+
+    /* Get Input and Output files */
+    sscanf(argv[2], &quot;%s&quot;, inname);
+    sscanf(argv[3], &quot;%s&quot;, outbit);
+    sscanf(argv[4], &quot;%s&quot;, outname);
+
+    if ((inp = fopen(inname,&quot;rb&quot;)) == NULL) {
+        printf(&quot;  G.722: Cannot read file %s.\n&quot;, inname);
+        exit(1);
+    }
+    if ((outbitp = fopen(outbit,&quot;wb&quot;)) == NULL) {
+        printf(&quot;  G.722: Cannot write file %s.\n&quot;, outbit);
+        exit(1);
+    }
+    if ((outp = fopen(outname,&quot;wb&quot;)) == NULL) {
+        printf(&quot;  G.722: Cannot write file %s.\n&quot;, outname);
+        exit(1);
+    }
+    printf(&quot;\nInput:%s\nOutput bitstream:%s\nOutput:%s\n&quot;, inname, outbit, outname);
+
+    /* Create and init */
+    WebRtcG722_CreateEncoder((G722EncInst **)&amp;G722enc_inst);
+    WebRtcG722_CreateDecoder((G722DecInst **)&amp;G722dec_inst);
+    WebRtcG722_EncoderInit((G722EncInst *)G722enc_inst);
+    WebRtcG722_DecoderInit((G722DecInst *)G722dec_inst);
+
+
+    /* Initialize encoder and decoder */
+    framecnt = 0;
+    endfile = false;
+    while (!endfile) {
+        framecnt++;
+
+        /* Read speech block */
+        endfile = readframe(shortdata, inp, framelength);
+
+        /* Start clock before call to encoder and decoder */
+        starttime = clock()/(double)CLOCKS_PER_SEC_G722;
+
+        /* G.722 encoding + decoding */
+        stream_len = WebRtcG722_Encode((G722EncInst *)G722enc_inst, shortdata, framelength, streamdata);
+        WebRtcG722_Decode(G722dec_inst, streamdata, stream_len, decoded,
+                          speechType);
+
+        /* Stop clock after call to encoder and decoder */
+        runtime += (double)((clock()/(double)CLOCKS_PER_SEC_G722)-starttime);
+
+        /* Write coded bits to file */
+        if (fwrite(streamdata, sizeof(short), stream_len / 2, outbitp) !=
+            stream_len / 2) {
+          return -1;
+        }
+        /* Write coded speech to file */
+        if (fwrite(decoded, sizeof(short), framelength, outp) !=
+            framelength) {
+          return -1;
+        }
+    }
+
+    WebRtcG722_FreeEncoder((G722EncInst *)G722enc_inst);
+    WebRtcG722_FreeDecoder((G722DecInst *)G722dec_inst);
+
+    length_file = ((double)framecnt*(double)framelength/16000);
+    printf(&quot;\n\nLength of speech file: %.1f s\n&quot;, length_file);
+    printf(&quot;Time to run G.722:      %.2f s (%.2f %% of realtime)\n\n&quot;, runtime, (100*runtime/length_file));
+    printf(&quot;---------------------END----------------------\n&quot;);
+
+    fclose(inp);
+    fclose(outbitp);
+    fclose(outp);
+
+    return 0;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartylibwebrtclibwebrtcxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj (212125 => 212126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj        2017-02-10 18:56:07 UTC (rev 212125)
+++ trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj        2017-02-10 19:03:56 UTC (rev 212126)
</span><span class="lines">@@ -21,6 +21,23 @@
</span><span class="cx"> /* End PBXAggregateTarget section */
</span><span class="cx"> 
</span><span class="cx"> /* Begin PBXBuildFile section */
</span><ins>+                4140B8201E4E3383007409E6 /* audio_encoder_pcm.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4140B8181E4E3383007409E6 /* audio_encoder_pcm.cc */; };
+                4140B8211E4E3383007409E6 /* audio_encoder_pcm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B8191E4E3383007409E6 /* audio_encoder_pcm.h */; };
+                4140B8221E4E3383007409E6 /* audio_decoder_pcm.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4140B81A1E4E3383007409E6 /* audio_decoder_pcm.cc */; };
+                4140B8231E4E3383007409E6 /* audio_decoder_pcm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B81B1E4E3383007409E6 /* audio_decoder_pcm.h */; };
+                4140B8241E4E3383007409E6 /* g711_interface.c in Sources */ = {isa = PBXBuildFile; fileRef = 4140B81C1E4E3383007409E6 /* g711_interface.c */; };
+                4140B8251E4E3383007409E6 /* g711_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B81D1E4E3383007409E6 /* g711_interface.h */; };
+                4140B8261E4E3383007409E6 /* g711.c in Sources */ = {isa = PBXBuildFile; fileRef = 4140B81E1E4E3383007409E6 /* g711.c */; };
+                4140B8271E4E3383007409E6 /* g711.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B81F1E4E3383007409E6 /* g711.h */; };
+                4140B8311E4E3396007409E6 /* audio_decoder_g722.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4140B8281E4E3396007409E6 /* audio_decoder_g722.cc */; };
+                4140B8321E4E3396007409E6 /* audio_decoder_g722.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B8291E4E3396007409E6 /* audio_decoder_g722.h */; };
+                4140B8331E4E3396007409E6 /* audio_encoder_g722.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4140B82A1E4E3396007409E6 /* audio_encoder_g722.cc */; };
+                4140B8341E4E3396007409E6 /* audio_encoder_g722.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B82B1E4E3396007409E6 /* audio_encoder_g722.h */; };
+                4140B8351E4E3396007409E6 /* g722_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 4140B82C1E4E3396007409E6 /* g722_decode.c */; };
+                4140B8361E4E3396007409E6 /* g722_enc_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B82D1E4E3396007409E6 /* g722_enc_dec.h */; };
+                4140B8371E4E3396007409E6 /* g722_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 4140B82E1E4E3396007409E6 /* g722_encode.c */; };
+                4140B8381E4E3396007409E6 /* g722_interface.c in Sources */ = {isa = PBXBuildFile; fileRef = 4140B82F1E4E3396007409E6 /* g722_interface.c */; };
+                4140B8391E4E3396007409E6 /* g722_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B8301E4E3396007409E6 /* g722_interface.h */; };
</ins><span class="cx">                 414D71141E4AE98C0023E526 /* user_socket.c in Sources */ = {isa = PBXBuildFile; fileRef = 414D71121E4AE9820023E526 /* user_socket.c */; };
</span><span class="cx">                 414D71171E4AEAFB0023E526 /* sctp_indata.c in Sources */ = {isa = PBXBuildFile; fileRef = 414D71151E4AEACD0023E526 /* sctp_indata.c */; };
</span><span class="cx">                 414D71191E4AEB110023E526 /* sctp_userspace.c in Sources */ = {isa = PBXBuildFile; fileRef = 414D71181E4AEB110023E526 /* sctp_userspace.c */; };
</span><span class="lines">@@ -2745,6 +2762,23 @@
</span><span class="cx"> /* End PBXCopyFilesBuildPhase section */
</span><span class="cx"> 
</span><span class="cx"> /* Begin PBXFileReference section */
</span><ins>+                4140B8181E4E3383007409E6 /* audio_encoder_pcm.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio_encoder_pcm.cc; path = g711/audio_encoder_pcm.cc; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B8191E4E3383007409E6 /* audio_encoder_pcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audio_encoder_pcm.h; path = g711/audio_encoder_pcm.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B81A1E4E3383007409E6 /* audio_decoder_pcm.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio_decoder_pcm.cc; path = g711/audio_decoder_pcm.cc; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B81B1E4E3383007409E6 /* audio_decoder_pcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audio_decoder_pcm.h; path = g711/audio_decoder_pcm.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B81C1E4E3383007409E6 /* g711_interface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = g711_interface.c; path = g711/g711_interface.c; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B81D1E4E3383007409E6 /* g711_interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = g711_interface.h; path = g711/g711_interface.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B81E1E4E3383007409E6 /* g711.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = g711.c; path = g711/g711.c; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B81F1E4E3383007409E6 /* g711.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = g711.h; path = g711/g711.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B8281E4E3396007409E6 /* audio_decoder_g722.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio_decoder_g722.cc; path = g722/audio_decoder_g722.cc; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B8291E4E3396007409E6 /* audio_decoder_g722.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audio_decoder_g722.h; path = g722/audio_decoder_g722.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B82A1E4E3396007409E6 /* audio_encoder_g722.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio_encoder_g722.cc; path = g722/audio_encoder_g722.cc; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B82B1E4E3396007409E6 /* audio_encoder_g722.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audio_encoder_g722.h; path = g722/audio_encoder_g722.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B82C1E4E3396007409E6 /* g722_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = g722_decode.c; path = g722/g722_decode.c; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B82D1E4E3396007409E6 /* g722_enc_dec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = g722_enc_dec.h; path = g722/g722_enc_dec.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B82E1E4E3396007409E6 /* g722_encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = g722_encode.c; path = g722/g722_encode.c; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B82F1E4E3396007409E6 /* g722_interface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = g722_interface.c; path = g722/g722_interface.c; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4140B8301E4E3396007409E6 /* g722_interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = g722_interface.h; path = g722/g722_interface.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 414D71121E4AE9820023E526 /* user_socket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = user_socket.c; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 414D71151E4AEACD0023E526 /* sctp_indata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sctp_indata.c; path = netinet/sctp_indata.c; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 414D71181E4AEB110023E526 /* sctp_userspace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sctp_userspace.c; path = netinet/sctp_userspace.c; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5319,6 +5353,37 @@
</span><span class="cx"> /* End PBXFrameworksBuildPhase section */
</span><span class="cx"> 
</span><span class="cx"> /* Begin PBXGroup section */
</span><ins>+                4140B8161E4E335E007409E6 /* g711 */ = {
+                        isa = PBXGroup;
+                        children = (
+                                4140B8181E4E3383007409E6 /* audio_encoder_pcm.cc */,
+                                4140B8191E4E3383007409E6 /* audio_encoder_pcm.h */,
+                                4140B81A1E4E3383007409E6 /* audio_decoder_pcm.cc */,
+                                4140B81B1E4E3383007409E6 /* audio_decoder_pcm.h */,
+                                4140B81C1E4E3383007409E6 /* g711_interface.c */,
+                                4140B81D1E4E3383007409E6 /* g711_interface.h */,
+                                4140B81E1E4E3383007409E6 /* g711.c */,
+                                4140B81F1E4E3383007409E6 /* g711.h */,
+                        );
+                        name = g711;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
+                4140B8171E4E3365007409E6 /* g722 */ = {
+                        isa = PBXGroup;
+                        children = (
+                                4140B8281E4E3396007409E6 /* audio_decoder_g722.cc */,
+                                4140B8291E4E3396007409E6 /* audio_decoder_g722.h */,
+                                4140B82A1E4E3396007409E6 /* audio_encoder_g722.cc */,
+                                4140B82B1E4E3396007409E6 /* audio_encoder_g722.h */,
+                                4140B82C1E4E3396007409E6 /* g722_decode.c */,
+                                4140B82D1E4E3396007409E6 /* g722_enc_dec.h */,
+                                4140B82E1E4E3396007409E6 /* g722_encode.c */,
+                                4140B82F1E4E3396007409E6 /* g722_interface.c */,
+                                4140B8301E4E3396007409E6 /* g722_interface.h */,
+                        );
+                        name = g722;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 5C0885111E4A99C200403995 /* include */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -7542,6 +7607,8 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 5CDD8C9D1E43C6EB00621E92 /* cng */,
</span><ins>+                                4140B8161E4E335E007409E6 /* g711 */,
+                                4140B8171E4E3365007409E6 /* g722 */,
</ins><span class="cx">                                 5CDD8AD61E43C29F00621E92 /* ilbc */,
</span><span class="cx">                                 5CDD876D1E43BB7E00621E92 /* isac */,
</span><span class="cx">                                 5CDD8C521E43C5F700621E92 /* opus */,
</span><span class="lines">@@ -9684,6 +9751,7 @@
</span><span class="cx">                                 5C63F7C61E416288002CA531 /* common.h in Headers */,
</span><span class="cx">                                 5CDD89421E43BF3A00621E92 /* common_header.h in Headers */,
</span><span class="cx">                                 5C6CDD4C1E413598009754E3 /* common_types.h in Headers */,
</span><ins>+                                4140B8391E4E3396007409E6 /* g722_interface.h in Headers */,
</ins><span class="cx">                                 5CDD8B871E43C2B500621E92 /* comp_corr.h in Headers */,
</span><span class="cx">                                 5CDD86461E43B8B500621E92 /* complex_fft_tables.h in Headers */,
</span><span class="cx">                                 5CDD90781E43D15C00621E92 /* complex_matrix.h in Headers */,
</span><span class="lines">@@ -9982,6 +10050,7 @@
</span><span class="cx">                                 5CDD872B1E43BABE00621E92 /* noise_gmm_tables.h in Headers */,
</span><span class="cx">                                 5CDD902A1E43CEDE00621E92 /* noise_level_estimator.h in Headers */,
</span><span class="cx">                                 5CDD902C1E43CEDE00621E92 /* noise_spectrum_estimator.h in Headers */,
</span><ins>+                                4140B8361E4E3396007409E6 /* g722_enc_dec.h in Headers */,
</ins><span class="cx">                                 5CDD85FF1E43B84E00621E92 /* noise_suppression.h in Headers */,
</span><span class="cx">                                 5CDD84EA1E43B0B600621E92 /* noise_suppression_impl.h in Headers */,
</span><span class="cx">                                 5CDD85FD1E43B84E00621E92 /* noise_suppression_x.h in Headers */,
</span><span class="lines">@@ -10062,6 +10131,7 @@
</span><span class="cx">                                 5CDD8BD81E43C2B500621E92 /* poly_to_lsp.h in Headers */,
</span><span class="cx">                                 5CFD54641E4C55D200482908 /* RTCAudioSource.h in Headers */,
</span><span class="cx">                                 5C63F9F81E4174F6002CA531 /* port.h in Headers */,
</span><ins>+                                4140B8251E4E3383007409E6 /* g711_interface.h in Headers */,
</ins><span class="cx">                                 5C63F9FB1E4174F6002CA531 /* portallocator.h in Headers */,
</span><span class="cx">                                 5C63F9FC1E4174F6002CA531 /* portinterface.h in Headers */,
</span><span class="cx">                                 5CDD8A461E43BFB300621E92 /* post_decode_vad.h in Headers */,
</span><span class="lines">@@ -10107,11 +10177,14 @@
</span><span class="cx">                                 5CDD8BDA1E43C2B500621E92 /* refiner.h in Headers */,
</span><span class="cx">                                 5C63FA021E4174F6002CA531 /* relayport.h in Headers */,
</span><span class="cx">                                 5C63FA051E4174F6002CA531 /* relayserver.h in Headers */,
</span><ins>+                                4140B8341E4E3396007409E6 /* audio_encoder_g722.h in Headers */,
+                                4140B8211E4E3383007409E6 /* audio_encoder_pcm.h in Headers */,
</ins><span class="cx">                                 5CDD89621E43BF3A00621E92 /* remb.h in Headers */,
</span><span class="cx">                                 5CDD8FDC1E43CD6600621E92 /* remote_bitrate_estimator_abs_send_time.h in Headers */,
</span><span class="cx">                                 5CDD8FDE1E43CD6600621E92 /* remote_bitrate_estimator_single_stream.h in Headers */,
</span><span class="cx">                                 5CDD8FE21E43CD6600621E92 /* remote_estimator_proxy.h in Headers */,
</span><span class="cx">                                 5C63F9631E41737B002CA531 /* remoteaudiosource.h in Headers */,
</span><ins>+                                4140B8321E4E3396007409E6 /* audio_decoder_g722.h in Headers */,
</ins><span class="cx">                                 5CDD84BC1E43AF1300621E92 /* render_queue_item_verifier.h in Headers */,
</span><span class="cx">                                 5CDD85191E43B1EA00621E92 /* rent_a_codec.h in Headers */,
</span><span class="cx">                                 5CDD89651E43BF3A00621E92 /* report_block.h in Headers */,
</span><span class="lines">@@ -10137,6 +10210,7 @@
</span><span class="cx">                                 5C4B4BC11E431C90002651C8 /* RTCAudioSource+Private.h in Headers */,
</span><span class="cx">                                 5C4B4BC31E431C90002651C8 /* RTCAudioTrack+Private.h in Headers */,
</span><span class="cx">                                 5C4B4BC51E431C90002651C8 /* RTCAVFoundationVideoSource+Private.h in Headers */,
</span><ins>+                                4140B8231E4E3383007409E6 /* audio_decoder_pcm.h in Headers */,
</ins><span class="cx">                                 5C63F8651E416288002CA531 /* rtccertificate.h in Headers */,
</span><span class="cx">                                 5C63F8671E416288002CA531 /* rtccertificategenerator.h in Headers */,
</span><span class="cx">                                 5C4B4BC81E431C90002651C8 /* RTCConfiguration+Private.h in Headers */,
</span><span class="lines">@@ -10300,6 +10374,7 @@
</span><span class="cx">                                 5C4B48F51E42C1E3002651C8 /* streamparams.h in Headers */,
</span><span class="cx">                                 5C63F89B1E416288002CA531 /* stringencode.h in Headers */,
</span><span class="cx">                                 5C63F89D1E416288002CA531 /* stringutils.h in Headers */,
</span><ins>+                                4140B8271E4E3383007409E6 /* g711.h in Headers */,
</ins><span class="cx">                                 5CDD87DA1E43BC0600621E92 /* structs.h in Headers */,
</span><span class="cx">                                 5C63FA0C1E4174F6002CA531 /* stun.h in Headers */,
</span><span class="cx">                                 5C63FA0F1E4174F6002CA531 /* stunport.h in Headers */,
</span><span class="lines">@@ -11458,6 +11533,7 @@
</span><span class="cx">                                 5CDD86441E43B8B500621E92 /* complex_bit_reverse.c in Sources */,
</span><span class="cx">                                 5CDD86471E43B8B500621E92 /* complex_fft.c in Sources */,
</span><span class="cx">                                 5CDD89441E43BF3A00621E92 /* compound_packet.cc in Sources */,
</span><ins>+                                4140B8371E4E3396007409E6 /* g722_encode.c in Sources */,
</ins><span class="cx">                                 5CDD8FEB1E43CDCA00621E92 /* config.cc in Sources */,
</span><span class="cx">                                 5C6CDD4D1E413598009754E3 /* config.cc in Sources */,
</span><span class="cx">                                 5CDD8FB21E43CD0700621E92 /* congestion_controller.cc in Sources */,
</span><span class="lines">@@ -11550,6 +11626,7 @@
</span><span class="cx">                                 5C4B4CD41E4320A9002651C8 /* file_impl.cc in Sources */,
</span><span class="cx">                                 5CDD84DF1E43B04D00621E92 /* file_player.cc in Sources */,
</span><span class="cx">                                 5C63F7E31E416288002CA531 /* file_posix.cc in Sources */,
</span><ins>+                                4140B8311E4E3396007409E6 /* audio_decoder_g722.cc in Sources */,
</ins><span class="cx">                                 5CDD84E01E43B04D00621E92 /* file_recorder.cc in Sources */,
</span><span class="cx">                                 5CDD8C8B1E43C66000621E92 /* file_utils.cc in Sources */,
</span><span class="cx">                                 5C63F7E61E416288002CA531 /* filerotatingstream.cc in Sources */,
</span><span class="lines">@@ -11583,6 +11660,7 @@
</span><span class="cx">                                 5CDD84B21E43AF1300621E92 /* gain_control_for_experimental_agc.cc in Sources */,
</span><span class="cx">                                 5CDD84B41E43AF1300621E92 /* gain_control_impl.cc in Sources */,
</span><span class="cx">                                 5CDD8BA41E43C2B500621E92 /* gain_dequant.c in Sources */,
</span><ins>+                                4140B8331E4E3396007409E6 /* audio_encoder_g722.cc in Sources */,
</ins><span class="cx">                                 5CDD8BA61E43C2B500621E92 /* gain_quant.c in Sources */,
</span><span class="cx">                                 5CDD90221E43CEDE00621E92 /* gain_selector.cc in Sources */,
</span><span class="cx">                                 5CDD83D51E439A6F00621E92 /* generic_decoder.cc in Sources */,
</span><span class="lines">@@ -11596,6 +11674,7 @@
</span><span class="cx">                                 5CDD85581E43B42B00621E92 /* h264.cc in Sources */,
</span><span class="cx">                                 5CDD83541E43257200621E92 /* h264_bitstream_parser.cc in Sources */,
</span><span class="cx">                                 5CDD83561E43257200621E92 /* h264_common.cc in Sources */,
</span><ins>+                                4140B8241E4E3383007409E6 /* g711_interface.c in Sources */,
</ins><span class="cx">                                 5CDD85501E43B42B00621E92 /* h264_objc.mm in Sources */,
</span><span class="cx">                                 5CDD83D91E439A6F00621E92 /* h264_sps_pps_tracker.cc in Sources */,
</span><span class="cx">                                 5C4B4BB71E431C90002651C8 /* h264_video_toolbox_decoder.cc in Sources */,
</span><span class="lines">@@ -11994,6 +12073,7 @@
</span><span class="cx">                                 5CDD85BC1E43B5C000621E92 /* stats_counter.cc in Sources */,
</span><span class="cx">                                 5C63F9701E41737B002CA531 /* statscollector.cc in Sources */,
</span><span class="cx">                                 5C63F9721E41737B002CA531 /* statstypes.cc in Sources */,
</span><ins>+                                4140B8381E4E3396007409E6 /* g722_interface.c in Sources */,
</ins><span class="cx">                                 5C63F8981E416288002CA531 /* stream.cc in Sources */,
</span><span class="cx">                                 5CDD85BF1E43B5C000621E92 /* stream_synchronization.cc in Sources */,
</span><span class="cx">                                 5C4B48F41E42C1E3002651C8 /* streamparams.cc in Sources */,
</span><span class="lines">@@ -12019,6 +12099,8 @@
</span><span class="cx">                                 5CDD84C31E43AF1300621E92 /* three_band_filter_bank.cc in Sources */,
</span><span class="cx">                                 5CDD8A571E43BFB300621E92 /* tick_timer.cc in Sources */,
</span><span class="cx">                                 5CDD87F71E43BDED00621E92 /* time_scheduler.cc in Sources */,
</span><ins>+                                4140B8261E4E3383007409E6 /* g711.c in Sources */,
+                                4140B8221E4E3383007409E6 /* audio_decoder_pcm.cc in Sources */,
</ins><span class="cx">                                 5CDD8A5A1E43BFB300621E92 /* time_stretch.cc in Sources */,
</span><span class="cx">                                 5CDD88DA1E43BE3D00621E92 /* time_util.cc in Sources */,
</span><span class="cx">                                 5C4B4CE91E4320A9002651C8 /* timestamp_extrapolator.cc in Sources */,
</span><span class="lines">@@ -12064,6 +12146,7 @@
</span><span class="cx">                                 5CDD86E31E43BA2800621E92 /* vad.cc in Sources */,
</span><span class="cx">                                 5CDD873A1E43BABE00621E92 /* vad_audio_proc.cc in Sources */,
</span><span class="cx">                                 5CDD873D1E43BABE00621E92 /* vad_circular_buffer.cc in Sources */,
</span><ins>+                                4140B8351E4E3396007409E6 /* g722_decode.c in Sources */,
</ins><span class="cx">                                 5CDD86D61E43BA2800621E92 /* vad_core.c in Sources */,
</span><span class="cx">                                 5CDD86D91E43BA2800621E92 /* vad_filterbank.c in Sources */,
</span><span class="cx">                                 5CDD86DC1E43BA2800621E92 /* vad_gmm.c in Sources */,
</span><span class="lines">@@ -12103,6 +12186,7 @@
</span><span class="cx">                                 5CDD847B1E43AE2900621E92 /* voe_network_impl.cc in Sources */,
</span><span class="cx">                                 5CDD847D1E43AE2900621E92 /* voe_rtp_rtcp_impl.cc in Sources */,
</span><span class="cx">                                 5CDD847F1E43AE2900621E92 /* voe_video_sync_impl.cc in Sources */,
</span><ins>+                                4140B8201E4E3383007409E6 /* audio_encoder_pcm.cc in Sources */,
</ins><span class="cx">                                 5CDD84811E43AE2900621E92 /* voe_volume_control_impl.cc in Sources */,
</span><span class="cx">                                 5CDD87401E43BABE00621E92 /* voice_activity_detector.cc in Sources */,
</span><span class="cx">                                 5CDD84C71E43AF1300621E92 /* voice_detection_impl.cc in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>