Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a42af2930bc4f814

Jump to content

G.711

From Wikipedia, the free encyclopedia
(Redirected from G711)
G.711
Pulse code modulation (PCM) of voice frequencies
StatusIn force
Year started1972
Latest version(02/00)
February 2000
OrganizationITU-T
Related standardsG.191, G.711.0, G.711.1, G.729
Domainaudio compression
Websitehttps://www.itu.int/rec/T-REC-G.711

G.711, Pulse code modulation (PCM) of voice frequencies, is a narrowband audio codec originally designed for use in telephony that provides toll-quality audio at a bit rate of 64 kbit/s. It is an ITU-T Recommendation (standard) for audio encoding first issued in December 1972.

G.711 passes audio signals in the frequency band of 300–3400 Hz and samples them at the rate of 8000 Hz, within a tolerance of 50 ppm.

It uses one of two different logarithmic companding algorithms: μ-law, which is used primarily in North America and Japan, and A-law, which is in use in most other countries outside North America. Each companded sample is quantized to eight bits, resulting in a 64 kbit/s bit rate.

G.711 is a required standard in many technologies, such as the H.320 and H.323 standards.[1] It can also be used for fax communication over IP networks (as defined in the T.38 specification).

Two enhancements to G.711 have been published: G.711.0 utilizes lossless data compression to reduce bandwidth usage, and G.711.1 increases audio quality by increasing bandwidth usage.

Features

[edit]

Types

[edit]

G.711 defines two main companding algorithms, the μ-law and A-law algorithms. Both are logarithmic, but A-law was specifically designed to be simpler for a computer to process.[citation needed] The standard also defines a sequence of repeating code values which defines the power level of 0 dB.

The μ-law and A-law algorithms encode 14-bit and 13-bit signed linear PCM samples, respectively, to 8-bit logarithmic samples. Thus, the G.711 encoder produces a 64 kbit/s bitstream for a signal sampled at 8 kHz.[1]

G.711 μ-law tends to give more resolution to higher range signals while G.711 A-law provides more quantization levels at lower signal levels.

The terms PCMU, G711u and G711MU are also used for G.711 μ-law, and PCMA and G711A for G.711 A-law.[2]

A-law

[edit]

The A-law algorithm takes a 13-bit signed linear audio sample as input and converts it to an 8-bit value as follows:

Linear input code
[note 1]
Compressed code
XOR 01010101
Linear output code
[note 2]
s0000000abcdxs000abcds0000000abcd1
s0000001abcdxs001abcds0000001abcd1
s000001abcdxxs010abcds000001abcd10
s00001abcdxxxs011abcds00001abcd100
s0001abcdxxxxs100abcds0001abcd1000
s001abcdxxxxxs101abcds001abcd10000
s01abcdxxxxxxs110abcds01abcd100000
s1abcdxxxxxxxs111abcds1abcd1000000
  1. ↑ This value is produced by taking the two's complement representation of the input value, and inverting all bits after the sign bit if the value is negative.
  2. ↑ Signed magnitude representation

where s is the sign bit, s is its inverse (i.e., positive values are encoded with MSB = s = 1), and bits marked x are discarded. Note that the first column of the table uses a different representation of negative values than the third column. So, for example, input decimal value −21 is represented in binary after bit inversion as 1000000010100, which maps to 00001010 (according to the first row of the table). When decoding, this maps back to 1000000010101, which is interpreted as output value −21 in decimal. Input value +52 (0000000110100 in binary) maps to 10011010 (according to the second row), which maps back to 0000000110101 (+53 in decimal).

This can be seen as a floating-point number with 4 bits of mantissa m (equivalent to a 5-bit precision), 3 bits of exponent e and 1 sign bit s, formatted as seeemmmm with the decoded linear value y given by the formula

which is a 13-bit signed integer in the range ±1 to ±(212 − 26). Note that no compressed code decodes to zero due to the addition of 0.5 (half of a quantization step).

In addition, the standard specifies that all resulting even bits (LSB is even) are inverted before the octet is transmitted. This is to provide plenty of 0/1 transitions to facilitate the clock recovery process in the PCM receivers. Thus, a silent A-law encoded PCM channel has the 8 bit samples coded 0xD5 instead of 0x80 in the octets.

When data is sent over E0 (G.703), MSB (sign) is sent first and LSB is sent last.

ITU-T STL[3] defines the algorithm for decoding as follows (it puts the decoded values in the 13 most significant bits of the 16-bit output data type).

void            alaw_expand(lseg, logbuf, linbuf)
  long            lseg;
  short          *linbuf;
  short          *logbuf;
{
  short           ix, mant, iexp;
  long            n;

  for (n = 0; n < lseg; n++)
  {
    ix = logbuf[n] ^ (0x0055);	/* re-toggle toggled bits */

    ix &= (0x007F);		/* remove sign bit */
    iexp = ix >> 4;		/* extract exponent */
    mant = ix & (0x000F);	/* now get mantissa */
    if (iexp > 0)
      mant = mant + 16;		/* add leading '1', if exponent > 0 */

    mant = (mant << 4) + (0x0008);	/* now mantissa left justified and */
    /* 1/2 quantization step added */
    if (iexp > 1)		/* now left shift according exponent */
      mant = mant << (iexp - 1);

    linbuf[n] = logbuf[n] > 127	/* invert, if negative sample */
      ? mant
      : -mant;
  }
}

[4]

μ-law

[edit]

The μ-law algorithm takes a 14-bit signed linear audio sample in two's complement representation as input, inverts all bits after the sign bit if the value is negative, adds 33 (binary 100001) and converts it to an 8-bit value as follows:

Linear input value
[note 1]
Compressed code
XOR 11111111
Linear output value
[note 2]
s00000001abcdxs000abcds00000001abcd1
s0000001abcdxxs001abcds0000001abcd10
s000001abcdxxxs010abcds000001abcd100
s00001abcdxxxxs011abcds00001abcd1000
s0001abcdxxxxxs100abcds0001abcd10000
s001abcdxxxxxxs101abcds001abcd100000
s01abcdxxxxxxxs110abcds01abcd1000000
s1abcdxxxxxxxxs111abcds1abcd10000000
  1. ↑ This value is produced by taking the two's complement representation of the input value, inverting all bits after the sign bit if the value is negative, and adding 33.
  2. ↑ Signed magnitude representation. Final result is produced by decreasing the magnitude of this value by 33.

where s is the sign bit, and bits marked x are discarded.

In addition, the standard specifies that the encoded bits are inverted before the octet is transmitted. Thus, a silent μ-law–encoded PCM channel transmits a stream of 0xFF octets, instead of 0x00.

Adding 33 is necessary so that all values fall into a compression group, and it is subtracted upon decoding.

Breaking down the encoded value formatted as seeemmmm into 4 bits of mantissa m, 3 bits of exponent e and 1 sign bit s, the decoded linear value y is given by the formula

which is a 14-bit signed integer in the range 0 to ±8031.

Note that 0 is transmitted as 0xFF, and −1 is transmitted as 0x7F, but when received the result is 0 in both cases.

G.711.0

[edit]

G.711.0, also known as G.711 LLC, utilizes lossless data compression to reduce bandwidth usage by as much as 50 percent.[5] Lossless compression of G.711 pulse code modulation was approved by the ITU-T in September 2009.[6][7]

G.711.1

[edit]

G.711.1, "Wideband embedded extension for G.711 pulse code modulation", is a higher-fidelity extension to G.711, ratified in 2008 and further extended in 2012.[8]

G.711.1 allows a series of enhancement layers on top of a raw G.711 core stream (Layer 0): Layer 1 codes 16-bit audio in the same 4 kHz narrowband, and Layer 2 allows 8 kHz wideband using MDCT; each uses a fixed 16 kbps in addition to the 64 kbps core. They may be used together or singly, and each encodes the differences from the previous layer. Ratified in 2012, Layer 3 extends Layer 2 to 16 kHz "superwideband," allowing another 16 kbps for the highest frequencies, while retaining layer independence. Peak bitrate becomes 96 kbps in original G.711.1, or 112 kbps with superwideband. No internal method of identifying or separating the layers is defined, leaving it to the implementation to packetize or signal them.[9][10]

A decoder that is unable to understand any set of fidelity layers may ignore or drop non-core packets without affecting it, enabling graceful degradation across any G.711 (or original G.711.1) telephony system with no changes.

Also ratified in 2012 was the extension of G.711.0 compression to the new fidelity layers. Like G.711.0, full G.711 backward compatibility is sacrificed for efficiency, though a G.711.0-aware node may still ignore or drop layer packets it is unable to understand.

Licensing

[edit]

The patents for G.711, released in 1972, have expired, so it may be used without the need for a license.[1]

See also

[edit]

References

[edit]
  1. 1 2 3 "G.711 : Pulse code modulation (PCM) of voice frequencies". itu.int. Archived from the original on 2019-06-17. Retrieved 2019-11-11.
  2. ↑ "Video/Voice/Speech Codecs". Grandstream=. Retrieved 19 July 2020.
  3. ↑ G.191 : Software tools for speech and audio coding standardization. Function alaw_expand in file Software/stl2009/g711/g711.c. Itu.int. Retrieved on 2013-09-18.
  4. ↑ See also "ITU-T Software Tool Library 2009 User's manual" that can be found at G.191 : ITU-T Software Tool Library 2009 User's manual.
  5. ↑ ITU-T (2009-07-17). "ITU-T Newslog - Voice codec gets new lossless compression". Archived from the original on 2016-03-03. Retrieved 2010-02-28.
  6. ↑ ITU-T. "G.711.0 : Lossless compression of G.711 pulse code modulation". Retrieved 2010-02-28.
  7. ↑ Recent Audio/Speech Coding Developments in ITU-T and future trends (PDF), August 2008, retrieved 2010-02-28
  8. ↑ G.711.1: Wideband embedded extension for G.711 pulse code modulation, ITU-T, 2012, retrieved 2022-12-24
  9. ↑ Lapierre; et al. (2008-08-25), Noise shaping in an ITU-T G.711-Interoperable embedded codec (PDF), retrieved 2024-06-11
  10. ↑ Hiwasaki; et al. (2008-08-25), G. 711.1: a wideband extension to ITU-T G. 711 (PDF), retrieved 2024-06-11
[edit]