Returns the original signal that was Shannon-Fano encoded. The signal
was encoded using shannonfanoenco
. This function uses
a dict built from the shannonfanodict
and uses it to decode a signal
list into a Shannon-Fano list. Restrictions include hcode is expected to be a binary code;
returned signal set that strictly belongs in the range [1,N]
,
with N = length (dict)
. Also dict can only be from the
shannonfanodict (...)
routine. Whenever decoding fails,
those signal values are indicated by -1, and we successively
try to restart decoding from the next bit that hasn’t failed in
decoding, ad-infinitum.
An example use of shannonfanodeco
is
hd = shannonfanodict (1:4, [0.5 0.25 0.15 0.10]); hcode = shannonfanoenco (1:4, hd) ⇒ hcode = [0 1 0 1 1 0 1 1 1 0] shannonfanodeco (hcode, hd) ⇒ [1 2 3 4]
See also: shannonfanoenco, shannonfanodict.
Package: communications