亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? spiht_wpackets.m

?? zerotree的寫法,給大家參考
?? M
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
function [Arec,bitstream,PSNR,MSE,D,Drec,s,p_stream]=spiht_wpackets(A,bpp,wavelet,no_decomp,pkt_depth,dec_type,varargin)
%[Arec,bitstream,PSNR,MSE,D,Drec,s,p_stream]=spiht_wpackets(A,bpp,wavelet,no_decomp,pkt_depth,dec_type,varargin)
%Version: 3.13, Date: 2006/04/10, author: Nikola Sprljan
%SPIHT image compression using Wavelet Packets (WP) decomposition
%
%Input: 
% A - array containing the original image or its filename
% bpp - vector of target decoding bitrates (bpp=bits per pixel) 
% wavelet - wavelet identification string
% no_decomp - [optional, default = max] the number of levels of dyadic 
%             decomposition. Default value is the maximum possible, e.g. down
%             to the LL subband of size 1x1 if the dimensions of an image are
%             powers of 2.
% pkt_depth - [optional, default = 0] maximum number of additional decomposition
%             levels for subbands; "packet decomposition depth"
% dec_type - type of the wavelet packets deconposition
%            if (dec_type == 'full') builds the full packets tree
%            if (dec_type == 'greedy') sub-optimal in terms of finding the 
%            minimal entropy, but faster
% varargin - parameters for entropy computation (see in decomp_packets.m)
%
%Output: 
% Arec - reconstructed image (if more than one decode bitrate is specified than
%        Arec contains the result of decoding at the highest bitrate)
% bitstream - output bitstream and side information; is of size (3,): 
%             (1,bitstream size) the bitstream 
%             (2,bitstream size) pass number of the SPIHT algorithm  
%             (3,bitstream size) bit class: 
%               {0 - header,1 - position bit,2 - sign bit,3 - refine bit}
% PSNR - PSNR of the reconstructed images (for all bpps)
% MSE - MSE of the reconstructed images
% D - wavelet coefficients after decomposition
% Drec - reconstructed wavelet coefficients 
% s - structure containing info on parent-children relationship between subbands
%     given by wavelet packets decomposition
% p_stream - stream of bits representing information on splitting decisions of
%            wavelet packets decomposition 
%
%Note: 
% spiht_wpackets.m calls the following external function (in this order):          
%   1. decomp_packets2D.m (wavelet packets decomposition),
%   2. pdf_opt.m (probability density function optimisation of the quantised 
%                 wavelet coefficient values; Laplace pdf),
%   3. recon_packets2D.m (wavelet packets reconstruction).    
% Output file SPIHTlog.txt contains statistics collected during the encoding 
% process.
%
%Uses: 
% pdf_opt.m 
% load_wavelet.m (Wavelet Toolbox)
% decomp_packets2D.m (Wavelet Toolbox)
% recon_packets2D.m (Wavelet Toolbox)
% iq_measures.m (Quality Assessment Toolbox)
%
%Example:
% [Arec,bitstream,PSNR]=spiht_wpackets('Lena512.png',1,'CDF_9x7',6); %as original binary-coded SPIHT
% [Arec,bitstream,PSNR]=spiht_wpackets(A,1,'haar');
% [Arec,bitstream,PSNR]=spiht_wpackets('Lena.bmp',[0.1 0.2 0.5 1],'CDF_9x7',5,4,'full','shannon');
% [Arec,bitstream,PSNR,MSE,D,Drec,s,p_stream]=spiht_wpackets('lena256.png',0.1,'CDF_9x7',5,4,'greedy','shannon',1.5);

if isstr(A)
    A=imread(A);
end;
if (ndims(A)>2) 
    error('Only indexed images are supported!');
end;
if (exist('decomp_packets2D.m') ~= 2)
    disp(sprintf('Warning: The function decomp_packets2D.m is not on the path, wavelet decomposition cannot be performed!'));
    disp(sprintf('Function decomp_packets2D.m is a part of Wavelet Toolbox'));
    return;
end;
if (exist('iq_measures.m') ~= 2)
    disp(sprintf('Warning: The function iq_measures.m is not on the path, the PSNR computation will not be performed!'));
    disp(sprintf('Function iq_measures.m is a part of Quality Assessment Toolbox'));
end;

if nargin<6
    dec_type='';
    if nargin<5
        pkt_depth=0;
        if nargin<4
            [Drows,Dcols]=size(A);
            rpow2=length(find(factor(Drows)==2));
            cpow2=length(find(factor(Dcols)==2));
            no_decomp=min(rpow2,cpow2);
            if 2^no_decomp==min(Drows,Dcols)
                no_decomp=no_decomp-1;   
            end;    
        end;
    end;
end;
fprintf('%d decompositions, %d packet depth, %s wavelet, highest bitrate %f bpp\n',...
    no_decomp,pkt_depth,wavelet,max(bpp));     

param = struct('N',no_decomp,'pdep',pkt_depth,'wvf',wavelet,'dec',dec_type);

ent_param = struct('ent',[],'opt',[]);
%loading wavelet
%load the wavelet here
if (isstr(wavelet))
    if (exist('load_wavelet.m') ~= 2)
        disp(sprintf('Warning: The function load_wavelet.m is not on the path, the specified wavelet cannot be loaded!'));
        disp(sprintf('Function load_wavelet.m is a part of Wavelet Toolbox'));
        return;
    end;
    param.wvf = load_wavelet(wavelet);
else
    param.wvf = wavelet;
end;

if nargin>6
    ent_param.ent=varargin{1};
    if nargin==8
        ent_param.opt=varargin{2};
    end;
else
    ent_param.ent='shannon';
end; 
param.meanvalue=round(mean(A(:)));
Am=double(A)-param.meanvalue;
%Am=A;param.meanvalue=0; %mean value shifting as in original SPIHT
tic;
[D,p_stream,s,E]=decomp_packets2D(Am,param,ent_param);
%global Dcmap; %enable this to load a decomposition matrix from the main environment
%D = Dcmap;

%mean value shifting as in original SPIHT /begin
%DLLr=size(A,1)/2^param.N;DLLc=size(A,2)/2^param.N;
%Dmean=mean(mean(D(1:DLLr,1:DLLc)));
%shift=0;
%while Dmean>1024 Dmean=Dmean/4;shift=shift+1;end;
%param.Dmean=ceil(Dmean);param.shift=shift;
%D(1:DLLr,1:DLLc)=D(1:DLLr,1:DLLc)-param.Dmean*4^param.shift;
%mean value shifting as in original SPIHT /end

fprintf('Image transformed in %.2f seconds\n',toc);
tic;
%fprintf('Entropy-  %f\n',E);
[M,s]=maximum_magnitudes(D,s);
fprintf('Maximum magnitudes computed in %.2f seconds\n',toc);
numbits=round(prod(size(A)).*bpp);
%SPIHT algorithm, coding&decoding at once (without output to a file!)
if pkt_depth>0
    %4 bits for depth of packet decomposition, 16 for the length of p_stream; not implemented
    header_size=51+4+16+length(p_stream);  
else
    header_size=51; %51 bits as in original SPIHT
end;
header=zeros(1,header_size);
header(1:8)=str2num(dec2bin(param.meanvalue,8)')';
header(9:22)=str2num(dec2bin(size(A,1),14)')';
header(23:36)=str2num(dec2bin(size(A,1),14)')';
header(37:41)=str2num(dec2bin(floor(log2(max(max(M(:,:,1))))),5)')';
header(42:45)=str2num(dec2bin(no_decomp,4)')';
if pkt_depth>0
    header(46)=1; %next five bits for the type of wavelet
    header(72:header_size)=p_stream;   
end;
fprintf('\nSPIHT algorithm...\n');
tic;
[Drec,Arec,bitstream,PSNR,MSE]=spihtalg(A,D,s,M,numbits,header_size,param,p_stream);%

bitstream(1,1:header_size)=header;
fprintf(' - completed in %.2f seconds\n',toc); 

function [Drec,Arec,bitstream,PSNR,MSE]=spihtalg(A,D,s,M,numbits,header_size,param,p_stream)
%Input: 
% A - array containing the original image or its filename
% D - wavelet coefficients of the original image
% s - structure containing info on parent-children relationship between
%     subbands (see in decomp_packets2D.m and in the function
%     maximum_magnitudes defined below) 
% M - sorted coefficients trees (see in maximum_magnitudes below)
% numbits - vector containing bit budgets for each of the specified bits
%           per pixel values
% header_size - header size in bits to be taken into account
% param - structure specifying the decomposition parametres (see
%         decomp_packets2D.m)
% p_stream - information necessary for reconstruction of wavelet packets
%            subbands (see decomp_packets2D.m)

N=param.N;
[Drows,Dcols]=size(D);
%fileout=fopen('fileout.bin','w');%f
maxcoeff=max(max(abs(D))); %maximum absolute coefficient 
if maxcoeff>0 
    nbit=floor(log2(maxcoeff)); %bits for first threshold
else %in case that image contains only DC component (which is previously substracted) 
    quantstep=0;
    return %the whole coding process is skipped
end;
%Energy=sum(sum(D.^2));
%RecEnergy=0;
%initialize all lists & variables
[LIP,endLIP,LIS,endLIS,LSP,endLSP]=initialize_lists(D,N);
LISnew=zeros(size(LIS));
LIStemp=zeros(64,3);
oldendLSP=0;
duzina=numel(D);
sizrow=Drows/2^N;
sizcol=Dcols/2^N;
Dqrows=Drows/4;
Dqcols=Dcols/4;
MagnL=M(:,:,1);
MagnD=M(:,:,2);
L_S=M(:,:,3); %matrix that links coefficient and the index of its subband
Drec=zeros(Drows,Dcols); %initialize matrix of reconstructed coefficients
bitstream=zeros(3,numbits(end),'uint8');
quantstep=2^nbit; %first threshold (threshold is equal to quantization step)
Dtype=1; %indicates D type of LIS element
pass=1; %first coding pass
%**STATS**
nowcd=fileparts(which('spiht_wpackets'));
namelog=fullfile(nowcd,'SPIHTlog.txt');
fid=fopen(namelog,'w');
count1=header_size; %bits reserved for header
[stats,fid]=show_stats(fid,'init',pass,count1);
cntbitout=1;
while numbits(cntbitout)<=header_size
    [MSE(cntbitout),PSNR(cntbitout)]=iq_measures(A,127*ones(size(A)));
    cntbitout=cntbitout+1;
end;
%2.SORTING PASS 
while 1
    %fprintf(fid,'Threshold = %.2f\n   ',quantstep);  %**STATS**
    fprintf(fid,'%2d.(%8d)   ',pass,count1+1);  %**STATS**
    %fprintf(fid,'%2d LIP\n',pass); %NS!
    %2.1. testing the significance of elements in LIP
    lipcnt=0;
    cntbit=count1;
    init=quantstep*3/2; 
    %RecEadd=init^2;
    for mlip=1:endLIP %LIP loop
        i=LIP(mlip,1);
        j=LIP(mlip,2);
        count1=count1+1;
        bitstream(1,count1)=(abs(D(i,j))>=quantstep);
        bitstream(2,count1)=pass;
        bitstream(3,count1)=1; %position bit
        if bitstream(1,count1) %significant goes to LSP
            %fprintf(fid,'%5.2f\n',D(i,j));  %**STATS**
            count1=count1+1;
            bitstream(1,count1)=(sign(D(i,j))==1);
            bitstream(2,count1)=pass;
            bitstream(3,count1)=2; %sign bit
            Drec(i,j)=sign(double(bitstream(1,count1))-0.5)*init;
            %RecEnergy=RecEnergy+RecEadd;
            endLSP=endLSP+1;
            LSP(endLSP,:)=[i j];
            %fwrite(fileout,1,'ubit1');%f
            %fwrite(fileout,sign(D(i,j)),'ubit1');%f
        else %otherwise stays in LIP
            lipcnt=lipcnt+1;
            LIP(lipcnt,:)=LIP(mlip,:);
            %fwrite(fileout,0,'ubit1');%f
        end;
        if count1+1>=numbits(cntbitout) %this limit is equivalent in terms of distortion (1 addidional bit wouldn't help)
            [Arec,PSNR(cntbitout),MSE(cntbitout)]=reconstruct(A,Drec,cntbitout,count1,quantstep,pass,param,p_stream);
            cntbitout=cntbitout+1;
        end;
        if cntbitout>length(numbits) %| abs(RecEnergy-Energy)/Energy<10^-7
            [stats,fid]=show_stats(fid,'LIP',pass,count1,stats,endLSP); %**STATS**
            [stats,fid]=show_stats(fid,'LIS',pass,count1,stats,endLSP);
            [stats,fid]=show_stats(fid,'LSP',pass,stats(pass,1).LSP-1,stats,endLSP);
            [stats,fid]=show_stats(fid,'total',pass,count1,stats,endLSP);
            fprintf('\n...LIP loop out');
            %fclose(fileout);
            return
        end;    
    end; %end of LIP loop
    endLIP=lipcnt;
    [stats,fid]=show_stats(fid,'LIP',pass,count1,stats,endLSP); %**STATS**
    %fprintf(fid,'%2d LIS\n',pass); %NS!
    %2.2. testing the significance of elements in LIS 
    mlis=0;
    mlistemp=0;
    endLIStemp=0;
    liscnt=0; 
    while mlis<endLIS
        if endLIStemp
            mlistemp=mlistemp+1;
            LISel=LIStemp(mlistemp,:);
            if mlistemp==endLIStemp
                mlistemp=0;
                endLIStemp=0;   
            end;    
        else
            mlis=mlis+1;
            LISel=LIS(mlis,:);
        end;
        i=LISel(1);
        j=LISel(2);
        subband_index=L_S(i,j);
        row=s(subband_index).band_abs(2);
        col=s(subband_index).band_abs(1);
        scalediff=s(subband_index).scalediff;
        rowrel=i-row;
        colrel=j-col;
        id=row+s(subband_index).addrows+(rowrel-1)*2.^scalediff+1;
        jd=col+s(subband_index).addcols+(colrel-1)*2.^scalediff+1;
        %2.2.1. for L type elements
        if ~LISel(3)
            polje=MagnL(id+(jd-1)*Drows); %children
            count1=count1+1;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久久精品免费观看国产蜜| 国产成人亚洲综合a∨婷婷图片| 日韩欧美123| 91影院在线免费观看| 美女视频黄频大全不卡视频在线播放| 中文字幕一区二区在线播放| 欧美激情中文不卡| 欧美艳星brazzers| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 老司机午夜精品| 亚洲免费毛片网站| 久久精品一级爱片| 91麻豆精品国产91久久久更新时间| 成人av电影在线| 精品一区二区日韩| 午夜伊人狠狠久久| 一区二区三区不卡在线观看| 欧美极品美女视频| 精品国产一区二区精华| 欧美日本在线观看| 色综合视频在线观看| 国产成人免费在线观看不卡| 九九热在线视频观看这里只有精品| 亚洲成人综合网站| 亚洲精品国产a| 最新日韩在线视频| 自拍视频在线观看一区二区| 国产欧美一区二区三区在线老狼| 日韩限制级电影在线观看| 欧美专区日韩专区| 91精品福利视频| 91麻豆文化传媒在线观看| 成人午夜激情在线| 国产.欧美.日韩| 国产剧情av麻豆香蕉精品| 男男成人高潮片免费网站| 天天亚洲美女在线视频| 亚洲综合激情另类小说区| 亚洲视频在线一区| 亚洲免费看黄网站| 亚洲黄色在线视频| 一区二区三区日韩| 亚洲综合无码一区二区| 一级女性全黄久久生活片免费| 亚洲乱码日产精品bd| 一区二区三区免费观看| 国产高清亚洲一区| 国产凹凸在线观看一区二区| 国产夫妻精品视频| 成人短视频下载| 色哟哟国产精品| 欧美探花视频资源| 7777精品伊人久久久大香线蕉超级流畅 | 亚洲女与黑人做爰| 亚洲激情在线激情| 亚洲图片自拍偷拍| 日韩精品一二三四| 狠狠v欧美v日韩v亚洲ⅴ| 国产夫妻精品视频| 91色porny| 在线电影国产精品| 欧美不卡一区二区| 国产精品美日韩| 亚洲精品国产精品乱码不99| 日韩制服丝袜av| 国产一区二区免费视频| 不卡高清视频专区| 欧美中文字幕不卡| 日韩精品一区二区三区四区视频 | 亚洲欧美影音先锋| 亚洲自拍都市欧美小说| 免费av网站大全久久| 懂色一区二区三区免费观看| 91国在线观看| 欧美大片在线观看一区二区| 欧美激情一区二区三区蜜桃视频| 亚洲裸体xxx| 日本美女视频一区二区| 成人性生交大片免费看中文网站| 色综合视频一区二区三区高清| 91精品国产麻豆国产自产在线 | 精品精品国产高清a毛片牛牛 | 亚洲免费伊人电影| 久久国产夜色精品鲁鲁99| 不卡大黄网站免费看| 欧美高清性hdvideosex| 国产欧美一二三区| 午夜视频在线观看一区二区 | 久久久精品黄色| 一区二区三区精品视频在线| 蜜臀a∨国产成人精品| www.成人网.com| 日韩午夜在线观看| 亚洲精品久久久久久国产精华液| 久久er精品视频| 欧美伊人久久大香线蕉综合69| 久久这里只有精品视频网| 亚洲资源在线观看| 国产成人一区二区精品非洲| 欧美精品aⅴ在线视频| 中文字幕一区二区三中文字幕| 久久99热国产| 欧美日韩国产综合视频在线观看 | 自拍偷自拍亚洲精品播放| 美日韩一级片在线观看| 在线视频一区二区免费| 国产拍揄自揄精品视频麻豆| 日本欧美肥老太交大片| 色欧美乱欧美15图片| 亚洲图片欧美综合| 成人教育av在线| 欧美成人精品二区三区99精品| 一区二区三区中文在线观看| 成人小视频免费在线观看| 日韩一区二区在线观看| 亚洲一区在线视频| 色偷偷88欧美精品久久久| 中文字幕精品综合| 黑人巨大精品欧美一区| 日韩欧美一区电影| 日韩av中文在线观看| 欧美亚洲综合一区| 亚洲精品日日夜夜| 97精品电影院| 中文字幕在线免费不卡| 成人一级黄色片| 国产午夜亚洲精品午夜鲁丝片| 美女一区二区视频| 日韩女优制服丝袜电影| 男女男精品视频| 日韩一区和二区| 蜜臀av性久久久久蜜臀av麻豆| 5858s免费视频成人| 五月婷婷综合在线| 精品视频一区二区不卡| 亚洲线精品一区二区三区八戒| www..com久久爱| 中文字幕在线观看一区| 91日韩在线专区| 亚洲黄网站在线观看| 欧美三片在线视频观看| 亚洲成av人综合在线观看| 91精品国产综合久久久久久 | 日韩理论在线观看| 91小视频免费观看| 一级做a爱片久久| 欧美乱妇15p| 捆绑变态av一区二区三区| 91精品国产入口在线| 伦理电影国产精品| 国产亚洲制服色| 成人av在线看| 亚洲一区二区三区四区在线观看| 欧美三片在线视频观看| 毛片不卡一区二区| 久久这里都是精品| 成人av在线一区二区| 一区二区三区日韩欧美精品| 欧美日韩国产在线播放网站| 另类小说图片综合网| 国产午夜精品福利| 色婷婷综合久久| 午夜成人免费视频| 久久亚区不卡日本| jlzzjlzz亚洲女人18| 亚洲午夜激情网站| 精品久久久久久亚洲综合网 | 五月激情六月综合| 日韩欧美在线综合网| 国产不卡视频一区| 亚洲成人综合在线| 久久综合99re88久久爱| 91同城在线观看| 老鸭窝一区二区久久精品| 欧美韩国日本不卡| 欧美日韩高清在线| 国产一区二区精品在线观看| 亚洲欧洲无码一区二区三区| 欧美精品vⅰdeose4hd| 国产成人午夜视频| 亚洲aaa精品| 欧美国产综合色视频| 在线综合视频播放| 成人黄色在线网站| 日本免费新一区视频| 亚洲欧洲国产日韩| 日韩午夜在线观看| 日本一区二区视频在线观看| 欧美最猛性xxxxx直播| 精品在线亚洲视频| 亚洲一二三四在线| 国产日韩av一区| 在线播放91灌醉迷j高跟美女 | 91女人视频在线观看| 美日韩一级片在线观看| 亚洲精品久久嫩草网站秘色| 亚洲精品在线一区二区| 欧美日本一区二区在线观看| 成人h动漫精品| 国内成人自拍视频|