# Interleaving or randomisation?

I am trying to implement a digital communication system as a learning exercise. For error correction, I am using two concatenated codes (RS and convolutional). However, I read that, in order to reduce the damage caused by burst errors (and in some cases controlling the DC level of the output signal), it is a good practice to add an interleaver/scrambler between them.

I know how an interleaver and a scrambler work, but I do not get what is the point of choosing one or another (if they are not both required). In what scenarios would one work better than the other and why?

• hey! I've not heard "randomiser" in this context before; are you referring to a scrambler, maybe? or some whitening operation? or a random interleaver? It would be really cool if you could tell us where that term is used :) – Marcus Müller Apr 19 '20 at 16:28
• @Marcus Muller Thank you for your correction! it was a bad translation, not an English native here – user3141592 Apr 19 '20 at 16:31
• Honestly, I'm not a native speaker myself, that's why I asked :) But if you mean scrambler, that I know. – Marcus Müller Apr 19 '20 at 16:34
• I tried to translate the Spanish term "aleatorizador", but yes, I was referring to something like the classic XOR scrambler – user3141592 Apr 19 '20 at 16:37

So, the technical difference between a scrambler and an interleaver:

• The interleaver is just a permutation of input symbols; a resorting.
• The scrambler is an operation designed to modify the transmitted symbol in such a way that they are not present in the output.

Thus, "scrambler" is a way less precise defined term. I usually define it as "operation that is easy to invert if you know the transmit operation, and typically fulfills more of a statistical purpose than a cryptographic one".

The typical purpose of a scrambler is to break up periodicities in the original symbol stream; this can, for example, be done by combining with a pseudorandom sequence. To de-scramble, the receiver would do the inverse combination (in case of XOR, it's autoinverse) with the same sequence. Often, that sequence is longer than a "block" of transmitted signals.

That way, you're basically applying an uncorrelated signal to your data signal; even if you had spikes in the spectrum of your data signal, because it had repetitiveness in it, these will (in expectation) be gone after scrambling, and you get a nice, white spectrum.

A white spectrum is important:

1. you will need to adhere to legal restrictions on power, and these usually specify "maximum power within a small bandwidth". So, if you want to use the most of your expensive spectrum, you want to have a nice PSD without peaks.
2. from frequency-selective channel point of view, having peaks in the spectrum is a dangerous game: if a deep fade happens to fall on the peak, you lose a lot of signal. You can "distribute" your risk better if you evenly use the channel.
3. from a synchronization point of view, for many synchronization algorithms, it's important that
• the spectrum is symmetric (e.g. for the band-edge frequency locked loop (FLL)) or
• that all symbols are equally likely (you'd have a peak at 0 Hz in your spectrum if you have an "average != 0" signal) (important for PLLs, otherwise the assumption that all symbols are equally likely breaks, and that breaks the optimality of "correcting" towards the closest correct phase)
• that there's no runs of constant symbols, even if that happens likely in the input data (e.g. constant-rate digital broadcasting: when there's no bits to transmit, because e.g. everything is silent or the video codec only needs to compress a still image, then you have to pad with 0s, so that you keep your symbol rate) (extremely crucial for symbol timing recovery to have enough symbol transitions)

The interleaver, on the other hand, doesn't change the fact that your data signal might have periodic components: sure, you're moving them to different positions, but they're still there; you just "moved" the spikes in the spectrum in phase, you have little chance of actually getting rid of them.

On the other hands, if you have a burst error on say symbols Nr. 100 to Nr. 200, your XOR-scrambler would still have that burst error in the same range. After a sufficiently long interleaver, the same burst error would be distributed to more or less isolated singular errors, which might be much better for the channel decoder down the processing line.

So, all in all:

• interleaver against burst errors
• scrambler against unwanted regularities in the signal.
• So it would be a good practice to implement both of them, isn't it? – user3141592 Apr 19 '20 at 19:23
• yes! you can often absorb the interleaving in the scrambler (write both steps down as a matrix of $\mathbb F_2$; the interleaver is just a permutation matrix, and the scrambler can often be written as band-structure matrix. – Marcus Müller Apr 19 '20 at 19:27
• Interesting! However, for what I read, the scrambler should be place at the beginning of the encoders and the interleaver at the output. Is this true? Wouldn't it be the same if both are placed at the output? – user3141592 Apr 19 '20 at 19:30
• well, yes; you need the output of the encoder to be white, and you want to deinterleave between your concatenated decoders, so you're right, not the solution here. – Marcus Müller Apr 19 '20 at 19:41

Scrambler is generally used on the message bits itself (before coding happens on the message bits) to prevent long run of 0s or 1s in the message bit pattern. Originally it came from ethernet technologies where timing clock was recovered from the transitions in bits. If there was long run of 0s and 1s, it was difficult to recover timing due to presence of no transitions. But the concept got extended to most digital communications techniques to increase the 'randomness' of message bits.

Interleaver is usually used on the coded bits (after the message bits have gone through coding), mainly to combat burst error. For example, for a rate 1/2 code, if you have 10 message bits, you get 10+20 coded bits. For systematic code, the first 10 bits are same as message. Suppose due to bursty error in channel, if last 5 bits of coded bits are in error, the whole block may be incorrect while decoding at the receiver. Hence they interleave the coded bits (it will no longer be systematic code then) and do de-interleaving at the receiver. The advantage is that, due to bursty error, the error is now spread over the whole 20 bits. Even if one bit is wrong somewhere, there is a good chance you will be able to recover the whole block with low rate of error.

• Thank you for your answer. I have one doubt about it. In a case such as the one I mentioned where there are both an RS encoder and a convolutional one, if I understood you correctly, it would be better to place the interleaver at the end of the second encoder instead of between both of them, am I wrong? – user3141592 Apr 19 '20 at 19:25