# [pskmail] Re: PskR - 4 level quantizer

• From: John Douyere <vk2eta@xxxxxxxxx>
• To: pskmail@xxxxxxxxxxxxx
• Date: Wed, 1 Feb 2012 15:10:25 +1100

```Hi Stefano,

I can comment on the code.

The Viterbi decoder is capable of handling "soft bits" meaning that we can
feed it with variable values that represent how certain we are that they
represent a 1 or a 0.

The coding is done such that +127 represents a "very sure 1", -128 a "very
sure zero" and 0 (or 1) a "not sure if it is a 1 or a 0".

That helps the decoder make soft decisions as to which value (binary 0 or
1) is more likely to be the correct one.

So here I use two criteria:

1. The angle is first: BPSK modulation is coded as 0 or 180 degree angle
phases and therefore I use the angle as the first criteria: 0 or 180 degree
decoded angle = "very sure 0 or 1" and  90 degrees is "either 0 or 1", then
for anything in between the certainty is proportional to the deviation from
90 degrees.

2. The amplitude: the concept being that is the received signal is faint
due to selective fading for example then the amplitude will be smaller than
the average signal and therefore we should apply some "discounting" to the
credibility of the phase information.

In my tests, using the soft decoding algorithm improves the robustness of
the signal to white noise by around 1 dB which may not be much but adds to
the whole coding gain.

Do you have a project in mind?

Hope this helps,

73, John

On 01/02/2012 7:24 AM, "Stefano" <stefano.banti@xxxxxxxx> wrote:

> Hi all,
>
> I'm a sporadic user of pskmail, software developer and ham radio op as
> well; I'm looking at the source code of fldigi because I'm interested in
> the pskr software modem implementation.
> Can someone explain (shortly) the method used for the 4-level softbit
> quantizer ? Or give a reference to find mathematics involved ?
>
> ...
>        averageamp = decayavg(averageamp, sigamp, SQLDECAY);
>        if (sigamp > 0 && averageamp > 0) {
>            softamp = clamp( averageamp / sigamp, 1.0, 1e6);
>        } else {
>            softamp = 1; // arbritary number (50% impact)
>        }
>        // Compute values between -128 and +127 for phase value only
>        if (phase > M_PI) {
>            softangle = (127 - (((2 * M_PI - phase) / M_PI) * (double)
> 255));
>        } else {
>            softangle = (127 - ((phase / M_PI) * (double) 255));
>        }
>        // Then apply impact of amplitude. Finally, re-centre on 127-128
>        // as the decoder needs values between 0-255
>        softbit = (unsigned char) ((softangle / (1 + softamp)) - 127);
> ...
>
> many thanks in advance
> Stefano ik2yxt.
>
>
>
```

### Other related posts: 