📄 imdct2.m
字号:
function [f]=imdct2(c,g1,p3,p4)%IMDCT2 2D Inverse Discrete Wilson transform.% Usage: f=imdct2(c,g);% f=imdct2(c,g1,g2);% f=imdct2(c,g1,g2,Ls);%% Input parameters:% c : Array of coefficients.% g,g1,g2 : Window functions.% Ls : Size of reconstructed signal.% Output parameters:% f : Output data, matrix.%% IMDCT2(c,g) will calculate a separable two dimensional inverse% MDCT transformation of the input coefficients c using the% window g. The number of channels is deduced from the size of the% coefficients c.%% IMDCT2(c,g1,g2) will do the same using the window g1 along the first% dimension, and window g2 the second dimension.%% IMDCT2(c,g1,g2,Ls) will cut the signal to size Ls after the% transformation is done.%% SEE ALSO: MDCT2, DGT2, WILDUAL% This program is free software: you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation, either version 3 of the License, or% (at your option) any later version.% % This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.% % You should have received a copy of the GNU General Public License% along with this program. If not, see <http://www.gnu.org/licenses/>.% Author : Peter Soendergaarderror(nargchk(2,4,nargin));doLs=0;switch nargin case 2 g2=g1; case 3 if prod(size(p3))>2 % Two windows was specified. g2=p3; else g2=g1; Ls=p3; doLs=1; end; case 4 g2=p3; Ls=p4; doLs=1;end; if size(g1,2)>1 if size(g1,1)>1 error('g1 must be a vector'); else % g1 was a row vector. g1=g1(:); end;end;if size(g2,2)>1 if size(g2,1)>1 error('g2 must be a vector'); else % g2 was a row vector. g2=g2(:); end;end;Lwindow1=size(g1,1);Lwindow2=size(g2,1);if ndims(c)<4 || ndims(c)>5 error('c must be 4 or 5 dimensional.');end;M1=size(c,1);N1=size(c,2);M2=size(c,3);N2=size(c,4);W=size(c,5);a1=M1;a2=M2;L1=a1*N1;L2=a2*N2;% Length of window must be dividable by M.% We cannot automically zero-extend the window, as it can% possible break some symmetry properties of the window, and we don't% know which symmetries to preserve.if rem(Lwindow1,M1)~=0 error('Length of window no. 1 must be dividable by M1.')end;if rem(Lwindow2,M2)~=0 error('Length of window no. 2 must be dividable by M2.')end;% If input is real, and window is real, output must be real as well.inputwasreal = (isreal(g1) && isreal(g2) && isreal(c));% --- first dimension% Change c to correct shape.c=reshape(c,M1*N1,L2*W);c=comp_igdgt(comp_idwiltiii(c,a1,M1),g1,a1,2*M1,L1,0,.5,0,0);% Check if Ls was specified.if doLs c=postpad(c,Ls(1));else Ls(1)=L1;end;% Change to correct sizec=reshape(c,Ls(1),L2,W);% Exchange first and second dimension.c=permute(c,[2,1,3]);% --- second dimension% Change c to correct shape.c=reshape(c,M2*N2,Ls(1)*W);c=comp_igdgt(comp_idwiltiii(c,a2,M2),g2,a2,2*M2,L2,0,.5,0,0);% Check if Ls was specified.if doLs c=postpad(c,Ls(2));else Ls(2)=L2;end;% Change to correct sizec=reshape(c,Ls(2),Ls(1),W);% Exchange first and second dimension.f=permute(c,[2,1,3]);% Clean signal if it is known to be realif inputwasreal f=real(f);end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -