% -*- texinfo -*- % @deftypefn {Function File} {@var{code_dictionary} =} tunstallcode (@var{probability_list}) % % Implementation of a @code{|A|}-bit tunstall coder given the source % probability of the @code{|A|} symbols from the source with @code{2^|A|} % code-words involved. The variable @var{probability_list} ordering of % symbols is preserved in the output symbol/code dictionary. % Tunstall code is a variable to fixed source coding scheme, % and the arrangement of the codeword list order corrseponds to % to the regular tunstall code ordering of the variable source % word list, and the codes for each of them are enumerations % from @code{1:2^N}. Return only the ordering (grouping) of source symbols % as their index of match is the corresponding code word. The % probabilites of the various symbols are also stored in here. % for example % % @example % [cw_list, prob_list] = tunstallcode([0.6 .3 0.1]) % @end example % % essentially you will use the cw_list to parse the input % and then compute the code as the binary value of their index % of match, since it is a variable to fixed code. % % Reference: 'Synthesis of noiseless compression codes', Ph.D. Thesis % of B.P. Tunstall, Georgia Tech, Sept 1967 % @end deftypefn