Home > freetb4matlab > comm > golombenco.m

golombenco

PURPOSE ^

%

SYNOPSIS ^

function [gcode,Ltot]=golombenco(sig,m)

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} {} golombenco (@var{sig}, @var{m})
%
% Returns the Golomb coded signal as cell array.
% Also  total length of output code in bits can be obtained.
% This function uses a @var{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 @var{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 doesnt 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 doesnt belong to case 1. Quotient is coded
% simply just using the unary code. Also accroding 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 exmaple of the use of @code{golombenco} is
% @example
% @group
%   golombenco(1:4,2) %  
%   golombenco(1:10,2) % 
% @end group
% @end example
% @end deftypefn
% @seealso{golombdeco}

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 22-May-2009 15:13:00 by m2html © 2003