checkdescendant.m

来自「SPIHT coding implementation. using wavel」· M 代码 · 共 44 行

M
44
字号
function value = checkDescendant(i, j, type, m)
% checkDescendant - significance search
%
% parameters:    i,j          - coords of the explored coef
%                type         - A(0) or B(1) type entry
%                m            - tile
% output:        value        - highest actual value in the tree

s = size(m,1);

S = [];

index = 0; a = 0; b = 0;

while ((2*i-1)<s & (2*j-1)<s) 
    a = i-1; b = j-1;                 

    mind = [2*(a+1)-1:2*(a+2^index)];  
    nind = [2*(b+1)-1:2*(b+2^index)];
    
    chk = mind <= s;
    len = sum(chk);
    if len < length(mind)
        mind(len+1:length(mind)) = [];
    end
   
    chk = nind <= s;
    len = sum(chk);
    if len < length(nind)
        nind(len+1:length(nind)) = [];
    end
    
    S = [S reshape(m(mind,nind),1,[])];
    
    index = index + 1;
    i = 2*a+1; j = 2*b+1;
end

% B type
if type == 1
    S(:,1:4) = [];; 
end

value = max(abs(S));

⌨️ 快捷键说明

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