G.726
# G.726

G.726 is an ITU-T ADPCM speech codec standard covering the transmission of voice at rates of 16, 24, 32, and 40 kbit/s. It was introduced to supersede both G.721, which covered ADPCM at 32 kbit/s, and G.723, which described ADPCM for 24 and 40 kbit/s. G.726 also introduced a new 16 kbit/s rate. The four bit rates associated with G.726 are often referred to by the bit size of a sample, which are 2, 3, 4, and 5-bits respectively. The corresponding wide-band codec based on the same technology is G.722.

The most commonly used mode is 32 kbit/s, which doubles the usable network capacity by using half the rate of G.711. It is primarily used on international trunks in the phone network and is the standard codec used in DECT wireless phone systems. The principal application of 24 and 16 kbit/s channels is for overload channels carrying voice in digital circuit multiplication equipment (DCME). The principal application of 40 kbit/s channels is to carry data modem signals in DCME, especially for modems operating at greater than 4800 bit/s.

## History

G.721 was introduced in 1984, while G.723 was introduced in 1988. They were folded into G.726 in 1990.

G.727 was introduced at the same time as G.726, and includes the same bit rates, but is optimized for packet circuit multiplex equipment (PCME) environment. This is achieved by embedding 2-bit quantizer to 3-bit quantizer and same for the higher modes. This allows dropping of the least significant bit from the bit stream without adverse effects on speech signal.

## Features

* Sampling frequency 8 kHz
* 16 kbit/s, 24 kbit/s, 32 kbit/s, 40 kbit/s bit rates available
* Generates a bitstream, therefore frame length is determined by packetization time (typically 80 samples for 10 ms frame size)
* Typical algorithmic delay is 0.125 ms, with no look-ahead delay
* G.726 is a waveform speech coder which uses Adaptive Differential Pulse Code Modulation (ADPCM)
* PSQM testing under ideal conditions yields mean opinion scores of 4.30 for G.726 (32 kbit/s), compared to 4.45 for G.711 (μ-law)
* PSQM testing under network stress yields mean opinion scores of 3.79 for G.726 (32 kbit/s), compared to 4.13 for G.711 (μ-law)
* 40 kbit/s G.726 can carry 12000 bit/s and slower modem signals, while 32 kbit/s G.726 can carry 2400 bit/s and slower modem signals well and 4800 bit/s with some more degradation than clear channel codecs.

## Endianness and payload type

Since the byte order for data protocols in the context of the internet was generally defined as big endian and called simply network byte order, as stated (among others) by the deprecated RFC 1700, the deprecated RFC 1890 did not explicitly define the endianness of the predecessor of G.726, G.721, in RTP either. Instead of that, in the deprecated RFC 1890, the use of big endian by the term network byte order was generally stated for all mentioned codecs again:

   "For multi-octet encodings, octets are transmitted in network byte order (i.e., most significant octet first)." — IETF, the deprecated RFC 1890, section 4.2

The payload type for G.721 was defined by the deprecated RFC 1890 as 2, thus a=rtpmap:2 G721/8000. In drafts for newer version of this RFC, it was reused for G.726, i.e. a=rtpmap:2 G726-32/8000.

Contrary to that the ITU explicitly defined the byte order in its recommendations regarding G.726 or respectively ADPCM, but in two different ways. Recommendation X.420 states, that it shall be little endian, respecting recommendation I.366.2 Annex E it should be big endian. This led to contradicting decisions in various implementations, as some manufacturers opted for little endian and others for big endian. The consequence was, that these implementations were incompatible, as decoding using the wrong byte order results in a heavily distorted audio signal. Therefore the unclear definition was fixed by the RFC 3551, which replaces RFC 1890. Section 4.5.4 in RFC 3551 defines the classical MIME-types G726-16, 24, 32 and 40 as little endian and introduces new MIME types for bis endian, which are AAL2-G726-16, 24, 32 and 40. The payload type was changed to dynamic, in order to prevent confusion. Instead of payload type 2 a dynamic payload in the range from 96 to 127 shall be used:

   "Note that the "little-endian" direction in which samples are packed into octets in the G726-16, -24, -32 and -40 payload formats specified here is consistent with ITU-T Recommendation X.420, but is the opposite of what is specified in ITU-T Recommendation I.366.2 Annex E for ATM AAL2 transport. A second set of RTP payload formats matching the packetization of I.366.2 Annex E and identified by MIME subtypes AAL2-G726-16, -24, -32 and -40 will be specified in a separate document." — IETF, RFC 3551, section 4.5.4
   "Payload type 2 was assigned to G721 in RFC 1890 and to its equivalent successor G726-32 in draft versions of this specification, but its use is now deprecated and that static payload type is marked reserved due to conflicting use for the payload formats G726-32 and AAL2-G726-32 (see Section 4.5.4)" — IETF, RFC 3551, section 6

| little endian (X.420 and RFC 3551) | big endian (I.366.2 Annex E and RFC 3551) | deprecated RFC 1890 |
| - | - | - |
| G726-16 a=rtpmap:{from 96 to 127} G726-16/8000 | AAL2-G726-16 a=rtpmap:{from 96 to 127} AAL2-G726-16/8000 | a=rtpmap:2 G726-16/8000 |
| G726-24 a=rtpmap:{from 96 to 127} G726-24/8000 | AAL2-G726-24 a=rtpmap:{from 96 to 127} AAL2-G726-24/8000 | a=rtpmap:2 G726-24/8000 |
| G726-32 a=rtpmap:{from 96 to 127} G726-32/8000 | AAL2-G726-32 a=rtpmap:{from 96 to 127} AAL2-G726-32/8000 | a=rtpmap:2 G726-32/8000 |
| G726-40 a=rtpmap:{from 96 to 127} G726-40/8000 | AAL2-G726-40 a=rtpmap:{from 96 to 127} AAL2-G726-40/8000 | a=rtpmap:2 G726-40/8000 |

Newer implementations respect the RFC 3551 and clearly distinct between G726-xx (little endian) and AAL2-G726-xx (big endian). The Gigaset C610 IP DECT phone, e.g., generates the following code in its SIP INVITE:

a=rtpmap:96 G726-32/8000 → dynamic payload type 96 and G.726 according to X.420, thus little endian, as defined in RFC 3551 a=rtpmap:97 AAL2-G726-32/8000 → dynamic payload type 97 and G.726 according to I.366.2 Annex E, thus big endian, as defined in RFC 3551 a=rtpmap:2 G726-32/8000 → static payload type 2 and G.726 with unpredictable endianness, like G.721 according to the deprecated RFC 1890

