Communication Technology

 

 

 

Encoding

 

'Encoding' in the text book is very generic term. To be honest, I haven't seen many cases people using this term in such a generic term in the field. Personally I think it is because it might not have been clearly defined at the beginning or so many diverse type of encoding technology came out and the definition got more fuzzy now. Even when people use the term 'Encoding', they tend to use it in a very specific context. So you don't get clear idea of the context in which the term is used, you might not clearly understand what it realy mean.

In this page, I will try to explain the term 'Encoding' in a generic term because it is how the term is described in many text book.

What does 'Encoding' actually mean?

In very generic form, 'Encoding' can be described as in the following diagram. Encoding is a process (or technique) to convert 'one form of Thing' into 'another form of thing'.

 

A form of 'Thing" in the original form of user data to be transmitted

Data block with an arrow pointing to the right

Encoding block

Arrow pointing right into a Signal block

Another form of 'Thing" that transformed (derived) from the original user data

Figure 1. Encoding sits between the user's data and the signal that carries it. The box in the middle holds a rule, and that same rule read backwards is the decoder at the far end.

Two things have to be true before we can call a transformation an encoding, and the drawing leaves both of them implicit. The first is that the mapping is agreed in advance. The transmitter and the receiver use the same rule, so the receiver can run that rule backwards. The second is that the mapping is deterministic. The same input always produces the same output, and that is what makes the reverse step possible at all.

The reverse step is decoding, and it is the reason the middle box is worth drawing as a box. Inside it sits a rule rather than a physical process. You can change the rule and leave everything on either side alone: the data is still the same data, and the medium is still the same medium.

Notice also what the drawing leaves out. It does not say the output is smaller, and it does not say the output is safer. An encoder may add bits rather than remove them, and channel coding does exactly that. So the word 'Encoding' tells you that a transformation happened. It does not tell you what the transformation was for, and that missing half is what the rest of this page supplies.

  • An encoding is a rule, not a device : the hardware that runs it is an implementation detail. What defines the encoding is the mapping from input to output, written down somewhere both ends can read.
  • Decoding is the same rule read backwards : if the receiver cannot recover the input, the operation is not an encoding. It is a lossy transformation, and you need to say so explicitly.
  • An encoder is allowed to make the data bigger : people expect encoding to mean compression, and it often means the opposite. Error correction buys reliability by spending extra bits.

What are the four types of encoder?

Now the question is what do you mean by 'Thing' in the above description. It would be even more difficult to define this 'Thing' because there are so many different kind of 'Things' that can be plug into this statement. The most practical way is just to see a lot of examples. However, in most textbook they tried to categorize the 'Thing' into two large groups called 'Digital' and 'Analog'. Using all the possible combination of the two category, they categorize the type of encoders into roughly 4 types as below.

 

 

 

 

A form of 'Thing" in the original form of user data to be transmitted

Data block with an arrow pointing to the right

Encoding block

Arrow pointing right into a Signal block

Another form of 'Thing" that transformed (derived) from the original user data

(1) Analog Data

==>

Analog Signal

(2) Analog Data

==>

Digital Signal

(3) Digital Data

==>

Analog Signal

(4) Digital Data

==>

Digital Signal

 

Let's briefly think of what each of these type mean. Actually each one of these topics are huge topic and almost impossible to describe it clearly with a few lines. So don't get disappointed even if you don't understand this description clearly just by reading this page.

Analog Data => Analog Signal : This is to convert one form of analog signal to another form of analog signal. Some example of this type are AM (Amplitude Modulation), FM(Frequency Modulation) and PM(Phase Modulation) etc. One typical example for this would be in AM / FM radio broadcasting. When people talk in a microphone, the sound wave is a Analog data and when it goes through the communication system, it converted (Encoded) into AM or FM electrical signal (Of course, you would need further study to understand what AM / FM mean).

Analog Data => Digital Signal : This is to convert an analog data to a digital signal. This is often called 'Digitization'. Typical example of this type is PCM (Pulse Code Modulation).

Digital Data => Analog Signal : This is to convert a digital form of data into Analog form of signal. Typical examples of this type are ASK(Amplitude Shift Keying), FSK(Frequency Shift Keying) and PSK(Phase Shift Keying).

Digital Data => Digital Signal : This is to convert a digital data to a digital signal. Typical examples of this types are RZ / NRZ, Menchester Coding, Bipolar AMI, B8ZS, Block Coding (3B/4B, 5B/6B, 8B/10B) etc. These are widely used in Digital communication over wireline.

 

  • The table asks two questions, not four : the first is whether the input is analog or digital, and the second is whether the output is analog or digital. Four rows is simply every combination of the two answers.
  • 'Data' and 'Signal' are not the same word : data is the information you started with, and signal is what actually travels on the medium. The table always changes one into the other, and it never changes data into data.
  • Rows 2 and 3 are the ones you meet every day : your phone digitises your voice on the way in, and then turns bits back into a radio waveform on the way out. Both conversions happen in the same handset, a few milliseconds apart.
  • Each row is a whole field of study : the four labels are categories, not techniques. PCM, FSK and 8B/10B each sit inside one of these rows, and each one has a page of its own.

Why Encoding ?

A transmission medium does not care what your bits mean. It has a bandwidth, a noise floor, and a set of frequencies where it behaves badly, and it applies all three to whatever you put on it. Encoding exists because the data you start with almost never suits that medium as it stands. Each heading below names one mismatch that an encoder is there to remove.

Matching the data to the medium

Let's start with the most basic mismatch of all. A microphone produces a continuously varying voltage, and an optical fibre carries pulses of light. Neither one can accept the other directly. So something has to sit in between and restate the information in terms the medium can actually carry. That restatement is the encoding, and the four encoder types above are four instances of it.

Using the bandwidth you paid for

Bandwidth is the expensive part of any communication system, so a careless mapping wastes real money. A raw rectangular pulse spreads its energy across a very wide frequency range, and most of that energy never reaches the receiver. A better mapping concentrates the same information into a narrower band. This is why 256QAM carries eight bits in one symbol where a simple on-off mapping carries one.

Keeping the receiver synchronized

The receiver runs its own clock, and that clock drifts. It stays aligned by watching the signal change, so a long run of the same level gives it nothing to work from. A well chosen encoding guarantees a transition every so often, whatever the data happens to be. Manchester coding is the strict form of that promise, because it puts a transition in the middle of every single bit.

Surviving the errors the medium will cause

Noise is not a possibility but a certainty, so the question is never whether bits flip. The real question is whether the receiver can tell that they flipped and put them back. Channel coding answers it by adding redundancy in a controlled way. The encoder sends more bits than the data strictly needs, and the decoder uses that surplus to detect and correct the errors.

Removing what the receiver does not need

Encoding also runs in the opposite direction, which surprises people who meet channel coding first. Most real data repeats itself, and a receiver that knows the repetition pattern does not need every copy. Source coding removes that redundancy before transmission, which is what MP3 does to audio and what H.264 does to video. So one encoder on the chain adds bits and another takes them away, and the industry calls both of them encoding.

  • Every encoding answers a constraint : if you can name the constraint, you can usually predict what the encoder does. Ask what the medium cannot carry, and the answer tells you what the encoder has to fix.
  • Two of these reasons look like opposites : source coding removes redundancy and channel coding puts redundancy back. They do not actually conflict, because the redundancy that comes back is designed for correction rather than left over from the source.
  • A real system does several of these at once : a phone call compresses the speech, protects it, and then shapes it for the air interface. Each stage is a separate encoder with a separate reason for existing.

Encoding, Modulation, Coding, Encryption - which word means what?

I said at the top of this page that 'Encoding' gets used loosely, and this is where that looseness causes real confusion. Four words describe operations that all convert one representation into another, and people swap them freely in conversation. They are not the same operation. What separates them is the goal, not the mechanism.

The table below sets them side by side. Read the third column first, because the goal is the part that actually distinguishes one from another.

Operation

What it converts

What it is trying to achieve

Typical examples

Source coding

data into fewer bits of data

Remove redundancy the receiver can reconstruct for itself.

MP3, H.264, ZIP

Channel coding

data into more bits of data

Add redundancy so the receiver can correct what the medium breaks.

Turbo, LDPC, Polar

Line coding

bits into a baseband waveform

Keep the receiver clocked, and keep the DC level balanced on the wire.

NRZ, Manchester, 8B/10B

Modulation

bits into a passband signal

Move the information onto a carrier frequency the antenna can radiate.

QPSK, 16QAM, OFDM

Encryption

data into data of the same size

Hide the content from anyone who does not hold the key.

AES, SNOW 3G, ZUC

Two of these rows are the ones people genuinely confuse. Line coding and modulation both turn bits into a waveform, and the boundary between them is the carrier. Line coding produces a signal centred on DC and sends it down a wire. Modulation produces a signal centred on a radio frequency and sends it to an antenna. So a wireline engineer says 'encoding' and means line coding, while a radio engineer says 'encoding' and often means channel coding.

The word 'coding' is ambiguous in the same way. In 3GPP documents 'coding' on its own almost always means channel coding, so 'code rate' and 'coding gain' are about redundancy and error correction. Nobody writes 'code rate' when discussing MP3, even though MP3 is coding too.

  • The goal separates these four, not the mechanism : all of them map one representation onto another, and you cannot distinguish them from the block diagram. You distinguish them by asking what problem the block was added to solve.
  • When someone says 'encoding', ask which layer they work at : the answer is usually enough. A transport engineer means line coding, a physical layer engineer means channel coding, and a media engineer means source coding.
  • Encryption is the one that changes neither size nor shape : the output is the same length as the input and still looks like data. That is why it is so easy to add to a chain, and also why it is easy to forget that it is there.

Where does encoding sit in a transmit chain?

Each of those operations has a place in the chain, and the order is not arbitrary. Put them in the wrong order and the system still runs, but it runs worse, and in one case it stops working altogether. Let's follow the chain from the user's data down to the medium, and then follow it back on the receive side.

Figure 2 puts the operations in transmit order, with the receive chain mirrored underneath. Read the top row from left to right, and watch the number of bits as you go: source coding takes bits away, and channel coding puts more back.

Transmit chain Source Data Source Coding Encryption Channel Coding Line Coding / Modulation Channel (wire, fibre, air) fewer bits more bits bits to waveform Receive chain Demodulation / Line Decoding Channel Decoding Decryption Source Decoding Recovered Data waveform to bits errors corrected data reconstructed

Figure 2. The transmit chain applies the operations in a fixed order, and the receive chain undoes them in exactly the reverse order. Source coding shrinks the data, channel coding expands it again, and only the last stage produces something a medium can carry.

  • Source coding comes first : there is no point protecting bits you are about to discard. The redundancy the source does not need is removed before the channel coder ever sees the data.
  • Encryption sits between the two coders : it runs after compression, because encrypted data looks close to random and a compressor can do nothing with it. It also runs before channel coding, so the error correction still protects what actually goes on the medium.
  • Channel coding is the last operation on the bits : its redundancy has to survive the medium, so nothing may remove it afterwards. This is the ordering that breaks the system outright if you get it wrong.
  • Only the final stage touches the medium : everything above it works on bits and numbers. Line coding and modulation are where those bits finally become a voltage, a pulse of light, or a radio wave.
  • The receiver runs the chain backwards : each transmit stage has exactly one inverse, and the inverses run in reverse order. If you can draw the transmit chain, you already know the receive chain.

Reference