⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 func_spiht_dec.m

📁 4-D SPHIT 压缩Matlab 程序
💻 M
📖 第 1 页 / 共 2 页
字号:
                        M(2*x-1,2*y,2*z,2*t-1) = -2^n  - 2^(n-1); 
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x-1 2*y 2*z 2*t-1];
                    ctr = ctr + 1;
                end
                
                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    ctr = ctr + 1;
                    LSP = [LSP; 2*x 2*y-1 2*z 2*t-1];
                    if in(1,ctr) == 1
                        M(2*x,2*y-1,2*z,2*t-1) = 2^n + 2^(n-1); 
                    else
                        M(2*x,2*y-1,2*z,2*t-1) = -2^n  - 2^(n-1);
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x 2*y-1 2*z 2*t-1];
                    ctr = ctr + 1;
                end
                
                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    ctr = ctr + 1;
                    LSP = [LSP; 2*x 2*y 2*z 2*t-1];
                    if in(1,ctr) == 1
                        M(2*x,2*y,2*z,2*t-1) = 2^n + 2^(n-1); 
                    else
                        M(2*x,2*y,2*z,2*t-1) = -2^n  - 2^(n-1); 
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x 2*y 2*z 2*t-1];
                    ctr = ctr + 1;
                end
                %*********************************
                if in(1,ctr) == 1
                    LSP = [LSP; 2*x-1 2*y-1 2*z-1 2*t];
                    ctr = ctr + 1;
                    if in(1,ctr) == 1
                        M(2*x-1,2*y-1,2*z-1,2*t) = 2^n + 2^(n-1); 
                    else
                        M(2*x-1,2*y-1,2*z-1,2*t) = -2^n  - 2^(n-1); 
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x-1 2*y-1 2*z-1 2*t];
                    ctr = ctr + 1;
                end
                
                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    ctr = ctr + 1;
                    LSP = [LSP; 2*x-1 2*y 2*z-1 2*t];
                    if in(1,ctr) == 1;
                        M(2*x-1,2*y,2*z-1,2*t) = 2^n + 2^(n-1); 
                    else
                        M(2*x-1,2*y,2*z-1,2*t) = -2^n  - 2^(n-1); 
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x-1 2*y 2*z-1 2*t];
                    ctr = ctr + 1;
                end
                
                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    ctr = ctr + 1;
                    LSP = [LSP; 2*x 2*y-1 2*z-1 2*t];
                    if in(1,ctr) == 1
                        M(2*x,2*y-1,2*z-1,2*t) = 2^n + 2^(n-1); 
                    else
                        M(2*x,2*y-1,2*z-1,2*t) = -2^n  - 2^(n-1);
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x 2*y-1 2*z-1 2*t];
                    ctr = ctr + 1;
                end
                
                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    ctr = ctr + 1;
                    LSP = [LSP; 2*x 2*y 2*z-1 2*t];
                    if in(1,ctr) == 1
                        M(2*x,2*y,2*z-1,2*t) = 2^n + 2^(n-1); 
                    else
                        M(2*x,2*y,2*z-1,2*t) = -2^n  - 2^(n-1); 
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x 2*y 2*z-1 2*t];
                    ctr = ctr + 1;
                end

                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    LSP = [LSP; 2*x-1 2*y-1 2*z 2*t];
                    ctr = ctr + 1;
                    if in(1,ctr) == 1
                        M(2*x-1,2*y-1,2*z,2*t) = 2^n + 2^(n-1); 
                    else
                        M(2*x-1,2*y-1,2*z,2*t) = -2^n  - 2^(n-1); 
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x-1 2*y-1 2*z 2*t];
                    ctr = ctr + 1;
                end
                
                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    ctr = ctr + 1;
                    LSP = [LSP; 2*x-1 2*y 2*z 2*t];
                    if in(1,ctr) == 1;
                        M(2*x-1,2*y,2*z,2*t) = 2^n + 2^(n-1); 
                    else
                        M(2*x-1,2*y,2*z,2*t) = -2^n  - 2^(n-1); 
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x-1 2*y 2*z 2*t];
                    ctr = ctr + 1;
                end
                
                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    ctr = ctr + 1;
                    LSP = [LSP; 2*x 2*y-1 2*z 2*t];
                    if in(1,ctr) == 1
                        M(2*x,2*y-1,2*z,2*t) = 2^n + 2^(n-1); 
                    else
                        M(2*x,2*y-1,2*z,2*t) = -2^n  - 2^(n-1);
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x 2*y-1 2*z 2*t];
                    ctr = ctr + 1;
                end
                
                if ctr > size(in,2)
                    return
                end
                if in(1,ctr) == 1
                    ctr = ctr + 1;
                    LSP = [LSP; 2*x 2*y 2*z 2*t];
                    if in(1,ctr) == 1
                        M(2*x,2*y,2*z,2*t) = 2^n + 2^(n-1); 
                    else
                        M(2*x,2*y,2*z,2*t) = -2^n  - 2^(n-1); 
                    end
                    ctr = ctr + 1;
                else
                    LIP = [LIP; 2*x 2*y 2*z 2*t];
                    ctr = ctr + 1;
                end 
                
                %**************************************
                if ((2*(2*x)-1) < size(M,1) & (2*(2*y)-1) < size(M,2) &(2*(2*z)-1) < size(M,3) & (2*(2*t)-1) < size(M,4))
                    LIS = [LIS; LIStemp(i,1) LIStemp(i,2) LIStemp(i,3) LIStemp(i,4) 1];
                    LIStemp = [LIStemp; LIStemp(i,1) LIStemp(i,2) LIStemp(i,3) LIStemp(i,4) 1];
                end
                LIS(temp,:) = []; temp = temp-1;
                
            else
                ctr = ctr + 1;
            end
        else
            if in(1,ctr) == 1
                x = LIStemp(i,1); y = LIStemp(i,2); z = LIStemp(i,3); t = LIStemp(i,4);
                LIS = [LIS; 2*x-1 2*y-1 2*z-1 2*t-1 0; 2*x-1 2*y 2*z-1 2*t-1 0; 2*x 2*y-1 2*z-1 2*t-1 0; 2*x 2*y 2*z-1 2*t-1 0;
                            2*x-1 2*y-1 2*z 2*t-1 0; 2*x-1 2*y 2*z 2*t-1 0; 2*x 2*y-1 2*z 2*t-1 0; 2*x 2*y 2*z 2*t-1 0;
                            2*x-1 2*y-1 2*z-1 2*t 0; 2*x-1 2*y 2*z-1 2*t 0; 2*x 2*y-1 2*z-1 2*t 0; 2*x 2*y 2*z-1 2*t 0;
                            2*x-1 2*y-1 2*z 2*t 0; 2*x-1 2*y 2*z 2*t 0; 2*x 2*y-1 2*z 2*t 0; 2*x 2*y 2*z 2*t 0;
                            ];
                LIStemp = [LIStemp; 2*x-1 2*y-1 2*z-1 2*t-1 0; 2*x-1 2*y 2*z-1 2*t-1 0; 2*x 2*y-1 2*z-1 2*t-1 0; 2*x 2*y 2*z-1 2*t-1 0;
                                    2*x-1 2*y-1 2*z 2*t-1 0; 2*x-1 2*y 2*z 2*t-1 0; 2*x 2*y-1 2*z 2*t-1 0; 2*x 2*y 2*z 2*t-1 0;
                                    2*x-1 2*y-1 2*z-1 2*t 0; 2*x-1 2*y 2*z-1 2*t 0; 2*x 2*y-1 2*z-1 2*t 0; 2*x 2*y 2*z-1 2*t 0;
                                    2*x-1 2*y-1 2*z 2*t 0; 2*x-1 2*y 2*z 2*t 0; 2*x 2*y-1 2*z 2*t 0; 2*x 2*y 2*z 2*t 0;
                                    ];
                LIS(temp,:) = []; temp = temp - 1;
            end
            ctr = ctr + 1;
        end
        i = i+1;
    end
    
    % Refinement Pass
    temp = 1;
    value = M(LSP(temp,1),LSP(temp,2),LSP(temp,3),LSP(temp,4));
    while (abs(value) >= 2^(n+1) & (temp <= size(LSP,1)))
        if ctr > size(in,2)
            return
        end

        value = value + ((-1)^(in(1,ctr) + 1)) * (2^(n-1))*sign(M(LSP(temp,1),LSP(temp,2),LSP(temp,3),LSP(temp,4))); 
        M(LSP(temp,1),LSP(temp,2),LSP(temp,3),LSP(temp,4)) = value;
        ctr = ctr + 1;
        temp = temp + 1;    
        if temp <= size(LSP,1)
            value = M(LSP(temp,1),LSP(temp,2),LSP(temp,3),LSP(temp,4));
        end
    end
    
    n = n-1;
end

⌨️ 快捷键说明

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