decoding.m

来自「EZW的matlab程序 基于小波变换对图像进行压缩编码的研究」· M 代码 · 共 65 行

M
65
字号
function [DecodeMat,flagMat,recvalue]=decoding(DecodeMat,flagMat,recvalue,antiQuantiMat,quantiflag,rIlist,scanorder,scancode,scNum,qrNum)
global row col

for r=1:row*col
    if flagMat(scanorder(r,1),scanorder(r,2))=='O'
        continue;
    elseif flagMat(scanorder(r,1),scanorder(r,2))=='X'
        continue;
    else
        if scancode(scNum)=='P'
            flagMat(scanorder(r,1),scanorder(r,2))='P';
            if quantiflag(qrNum)==1
                qValue=antiQuantiMat(rIlist(qrNum),2);
                recvalue=[recvalue;qValue,scanorder(r,1),scanorder(r,2)];
                DecodeMat(scanorder(r,1),scanorder(r,2))=qValue;
                qrNum=qrNum+1;
            else
                qValue=antiQuantiMat(rIlist(qrNum),1);
                recvalue=[recvalue;qValue,scanorder(r,1),scanorder(r,2)];
                DecodeMat(scanorder(r,1),scanorder(r,2))=qValue;
                qrNum=qrNum+1;
            end
            scNum=scNum+1;
        elseif scancode(scNum)=='N'
            flagMat(scanorder(r,1),scanorder(r,2))='N';
            if quantiflag(qrNum)==1
                qValue=-antiQuantiMat(rIlist(qrNum),2);
                recvalue=[recvalue;qValue,scanorder(r,1),scanorder(r,2)];
                DecodeMat(scanorder(r,1),scanorder(r,2))=qValue;
                qrNum=qrNum+1;
            else
                qValue=-antiQuantiMat(rIlist(qrNum),1);
                recvalue=[recvalue;qValue,scanorder(r,1),scanorder(r,2)];
                DecodeMat(scanorder(r,1),scanorder(r,2))=qValue;
                qrNum=qrNum+1;
            end
            scNum=scNum+1;
        elseif scancode(scNum)=='Z'
            DecodeMat(scanorder(r,1),scanorder(r,2))=0;
            scNum=scNum+1;
        elseif scancode(scNum)=='T'
            flagMat(scanorder(r,1),scanorder(r,2))='T';
            DecodeMat(scanorder(r,1),scanorder(r,2))=0;
            chTree=treeMat(scanorder(r,1),scanorder(r,2));
            rowch=size(chTree,1);
            for rc=1:rowch
                if flagMat(chTree(rc,1),chTree(rc,2))~='O'
                    flagMat(chTree(rc,1),chTree(rc,2))='X';
                end
            end
            scNum=scNum+1;
        end
    end
end
Decodeflag=flagMat;
for i=1:row
    for j=1:col
        switch flagMat(i,j)
            case {'P','N'}
                flagMat(i,j)='O';
            case {'T','X'}
                flagMat(i,j)='Z';
        end
    end
end

⌨️ 快捷键说明

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