start_model_fixed.m

来自「多值自适应算数编码」· M 代码 · 共 27 行

M
27
字号
function start_model_fixed

format long

global no_of_chars no_of_symbols cum_freq char_to_index index_to_char freq

freq=[0 1 1 1 1 1 1 1 1 1 1 124 1 1 1 1 1 ...
        1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
        1236 1 21 9 3 1 25 15 2 2 2 1 79 19 60 1 ...
        15 15 8 5 4 7 5 4 4 6 3 2 1 1 1 1 ...
        1 24 15 22 12 15 10 9 16 16 8 6 12 23 13 11 ...
        14 1 14 28 29 6 3 11 1 3 1 1 1 1 1 3 ...
        1 491 85 173 232 744 127 110 293 418 6 39 250 139 429 446 ...
        111 5 388 375 531 152 57 97 12 101 5 2 1 2 3 1 ...
        ones(1,129)];

% This conversion is to be checked later
for ii=1:no_of_chars
    char_to_index(ii)=ii+2; % was ii+1
    index_to_char(ii+2)=ii; % was ( ii+1 )
end

cum_freq(no_of_symbols)=0;

for ii=no_of_symbols:-1:2
    cum_freq(ii-1)=cum_freq(ii)+freq(ii);
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?