📄 ezwdecode_old.m
字号:
function DeMat=ezwdecode(Mat,T1,decodeDim,CodeList,LenSubCL,QuantiFlagList,LenSubQFL,IntervalList)
global row col
recvalue=[];
scanorder=listorder(row,col,1,1);
flagMat(1:row,1:col)='Z';
for level=1:decodeDim
scancode=CodeList(1:LenSubCL(level));
CodeList=CodeList(LenSubCL(level)+1:end);
quantiflag=QuantiFlagList(1:LenSubQFL(level));
QuantiFlagList=QuantiFlagList(LenSubQFL(level)+1:end);
rIlist=IntervalList(1:LenSubQFL(level));
IntervalList=IntervalList(LenSubQFL(level)+1:end);
decode=[];
sclen=length(scancode);
quantifier=[];
maxInterValue=2*T1;
threshold=T1/2^(level-1);
intervalNum=maxInterValue/threshold-1;
for i=1:intervalNum
quantifier=[quantifier;threshold*i threshold*(i+0.5) threshold*(i+1) threshold*(i+0.25) threshold*(i+0.75)];
end
DeMat=Mat;
qrNum=1;
if ~isempty(recvalue)
[rvRow,rvCol]=size(recvalue);
for i=1:rvRow
if quantiflag(qrNum)==1
qValue=quantifier(rIlist(qrNum),5);
if recvalue(i)<0
qValue=-qValue;
end
recvalue(i,1)=qValue;
DeMat(recvalue(i,2),recvalue(i,3))=qValue;
qrNum=qrNum+1;
else
qValue=quantifier(rIlist(qrNum),4);
if recvalue(i)<0
qValue=-qValue;
end
recvalue(i,1)=qValue;
DeMat(recvalue(i,2),recvalue(i,3))=qValue;
qrNum=qrNum+1;
end
end
end
[Deflag,flagMat]=decodeflag(flagMat,sclen,scancode,scanorder);
[DecodeMat,recvalue]=decodemat(DeMat,Deflag,quantifier,quantiflag,rIlist,recvalue,qrNum);
recvalue
DeMat=DecodeMat;
DeMat(1:row/8,1:col/8);
% scNum=1;
% r=1;
% while (scNum<sclen+1)&&(r<row*col+1)
% switch flagMat(scanorder(r,1),scanorder(r,2))
% case {'O','X'}
% r=r+1;
% otherwise
% switch scancode(scNum)
% case 'P'
% flagMat(scanorder(r,1),scanorder(r,2))='P';decode=[decode 'P'];
% scNum=scNum+1;
% r=r+1;
% case 'N'
% flagMat(scanorder(r,1),scanorder(r,2))='N';decode=[decode 'N'];
% scNum=scNum+1;
% r=r+1;
% case 'Z'
% flagMat(scanorder(r,1),scanorder(r,2))='Z';decode=[decode 'Z'];
% scNum=scNum+1;
% r=r+1;
% case 'T'
% flagMat(scanorder(r,1),scanorder(r,2))='T';decode=[decode 'T'];
% chTree=treeMat(scanorder(r,1),scanorder(r,2));
% [chr,chc]=size(chTree);
% for cT=1:chr
% if flagMat(chTree(cT,1),chTree(cT,2))~='O'
% flagMat(chTree(cT,1),chTree(cT,2))='X';
% end
% end
% scNum=scNum+1;
% r=r+1;
% end
% end
% end
%
% Deflag=flagMat;
% for i=1:row
% for j=1:col
% switch flagMat(i,j)
% case {'P','N','O'}
% flagMat(i,j)='O';
% otherwise
% flagMat(i,j)='Z';
% end
% end
% end
%
% for r=1:row
% for c=1:col
% switch Deflag(r,c)
% case 'P'
% if quantiflag(qrNum)==1
% qValue=quantifier(rIlist(qrNum),5);
% recvalue=[recvalue;qValue,r,c];
% DeMat(r,c)=qValue;
% qrNum=qrNum+1;
% else
% qValue=quantifier(rIlist(qrNum),4);
% recvalue=[recvalue;qValue,r,c];
% DeMat(r,c)=qValue;
% qrNum=qrNum+1;
% end
% case 'N'
% if quantiflag(qrNum)==1
% qValue=-quantifier(rIlist(qrNum),5);
% recvalue=[recvalue;qValue,r,c];
% DeMat(r,c)=qValue;
% qrNum=qrNum+1;
% else
% qValue=-quantifier(rIlist(qrNum),4);
% recvalue=[recvalue;qValue,r,c];
% DeMat(r,c)=qValue;
% qrNum=qrNum+1;
% end
% case {'Z','T'}
% DeMat(r,c)=0;
% end
% end
% end
% Deflag
% scancode
% decode
% sclen
% scNum
% if level<decodeDim
% button = questdlg('Need the nest decode processing ?','Decode Level','Yes','No','Yes');
% if button(1)=='N'
% break;
% end
% end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -