lifting_quincunx.m

来自「MATLAB Code for Optimal Quincunx Filter 」· M 代码 · 共 33 行

M
33
字号
function [h0,h1] = lifting_quincunx(f, flag)
% compute the analysis filters from lifting steps based on quincunx sampling
% assume the first lifting step is from the zeroth channel to the first channel
% input:       f -- vector consisting of lifting filters
%                   the ith element of f is the ith lifting filter
%           flag -- 0 - regular downsampling matrix; 1 - twin-dragon type
% output: h0, h1 -- the zeroth and first analysis filters
% Copyright (c) 2006 Yi Chen

syms z0 z1 z00 z01;

p = sym(diag([1,1]));

for i = 1:length(f)
    if mod(i,2) == 1
        A = [1 0; f(i) 1];
    else
        A = [1 f(i); 0 1];
    end
    p = A*p;
end

% the "polyphase" matrix in upsampled domain
if flag == 0
    p_up = subs(subs(p,{z0,z1},{z00*z01,z00*z01^(-1)}),{z00,z01},{z0,z1});
    h0 = expand(p_up(1,1) + z0*p_up(1,2));
    h1 = expand(p_up(2,1) + z0*p_up(2,2));
elseif flag == 1
    p_up = subs(subs(p,{z0,z1},{z00*z01,z00^(-1)*z01}),{z00,z01},{z0,z1});
    h0 = expand(p_up(1,1) + z1*p_up(1,2));
    h1 = expand(p_up(2,1) + z1*p_up(2,2));
end

⌨️ 快捷键说明

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