基于小波的SPIHT编码

源代码在线查看: func_mydescendant.m

软件大小: 174 K
上传用户: shanon
关键词: SPIHT 编码
下载地址: 免注册下载 普通下载 VIP

相关代码

				function value = func_MyDescendant(i, j, type, m)
				% Matlab implementation of SPIHT (without Arithmatic coding stage)
				%
				% Find the descendant with largest absolute value of pixel (i,j)
				%
				% input:    i : row coordinate
				%           j : column coordinate
				%           type : type of descendant
				%           m : whole image
				%
				% output:   value : largest absolute value
				%
				% By Jing Tian, scuteejtian@hotmail.com
				
				s = size(m,1);
				
				S = [];
				
				index = 0; a = 0; b = 0;
				
				while ((2*i-1)				    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 				    len = sum(chk);
				    if len < length(mind)
				        mind(len+1:length(mind)) = [];
				    end
				    
				    
				    chk = nind 				    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
				
				if type == 1
				    S(:,1:4) = [];; 
				end
				
				value = max(abs(S));			

相关资源