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

📄 subband_dim.m

📁 小波压缩编码平台软件包
💻 M
字号:
function [ld,hd,N] = subband_dim(sdim, N)
%[ld,hd]= subband_dim(sdim, N)
%Version: 1.00, Date: 2006/11/01, author: Nikola Sprljan
%Computes the subband dimensions for a specified number of decompositions
%
%Input:
% sdim - vector of lengths of the original signal
% N - number of signal decompositions
%
%Output:
% ld - size of the low-pass signal after N levels of decomposition
% hd - size of the high-pass signal after N levels of decomposition 
% N - number of actually performed number of decompositions
%
%Note:
% If N is too large, the function will return ld = 1, and N will equal 
% the number of allowed decompositions.
% The parameter upper_limit sets the convention that the lower subband is 
% always of higher or equal number of sampels than the high-pass one, e.g.
% the upper limit for number of signal decompositions will be reached. If
% this parameter is changed, the same should be done in the whole Wavelet
% Toolbox.
% In the smallest non-singleton dimension direction the low-pass subband 
% can have only one coefficient.
%
%Example:
% [ld,hd,N]= subband_dim(9, 3); %if upper_limit = 1 -> ld = 2, hd = 1
% [ld,hd,N]= subband_dim(100, Inf); %for max. number of decompositions

sdim = double(sdim);
ld = zeros(size(sdim));
hd = zeros(size(sdim));
n = zeros(size(sdim)); 

for d=1:length(sdim)
    if (sdim(d) == 1) %singleton dimension, skip it!
        ld(d) = 1;
        hd(d) = 1;
        n(d) = N;
    else
       n(d) = sb_dim(sdim(d),N);
    end;
end;
 
N = min(n);
for d=1:length(sdim)
 [n(d),ld(d),hd(d)] = sb_dim(sdim(d),N);
end;

function [i,ld,hd] = sb_dim(sdim,N)
upper_limit = 1; %parameter defining splitting (see in Note)
ld = sdim;
hd = 0;
for i=1:N
    ldold = ld;
    if (upper_limit == 1)
        ld = ceil(ldold / 2);
    else
        ld = floor(ldold / 2);
    end;
    hd = ldold - ld;
    if (ld == 1) break; end;
end;

⌨️ 快捷键说明

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