Returns the Golomb coded signal as cell array. Also total length of output code in bits can be obtained. This function uses a m need to be supplied for encoding signal vector into a Golomb coded vector. A restrictions is that a signal set must strictly be non-negative. Also the parameter m need to be a non-zero number, unless which it makes divide-by-zero errors. The Golomb algorithm [1], is used to encode the data into unary coded quotient part which is represented as a set of 1’s separated from the K-part (binary) using a zero. This scheme doesn’t need any kind of dictionaries, it is a parameterized prefix codes. Implementation is close to O(N^2), but this implementation *may be* sluggish, though correct. Details of the scheme are, to encode the remainder(r of number N) using the floor(log2(m)) bits when rem is in range 0:(2^ceil(log2(m)) - N), and encode it as r+(2^ceil(log2(m)) - N), using total of 2^ceil(log2(m)) bits in other instance it doesn’t belong to case 1. Quotient is coded simply just using the unary code. Also according to [2] Golomb codes are optimal for sequences using the Bernoulli probability model: P(n)=p^n-1.q & p+q=1, and when M=[1/log2(p)], or P=2^(1/M).
Reference: 1. Solomon Golomb, Run length Encodings, 1966 IEEE Trans Info’ Theory. 2. Khalid Sayood, Data Compression, 3rd Edition
An example of the use of golombenco
is
golombenco (1:4, 2) ⇒ {[0 1], [1 0 0], [1 0 1], [1 1 0 0]} golombenco (1:10, 2) ⇒ {[0 1], [1 0 0], [1 0 1], [1 1 0 0], [1 1 0 1], [1 1 1 0 0], [1 1 1 0 1], [1 1 1 1 0 0], [1 1 1 1 0 1], [1 1 1 1 1 0 0]}
See also: golombdeco.
Package: communications