spiht_main.m

来自「用matlab做的三维视频压缩编码算法」· M 代码 · 共 42 行

M
42
字号
function Y_new = SPIHT_main(nFrame,filename)
%
% This function implements the 3D-SPIHT algorithm. 
% input:    filename: the video sequence in CIF,QCIF or SIF format
%           nFrame: number of frames to read from the filename specified
% output:   Y_new: the reconstructed video sequence
%
%
% Athanasopoulos Dionysios 
% Postgraduate Student
% Computer Engineering and Informatics Dept.
% University of Patras, Greece
%


% reads the luminance (Y) component from the filename specified. The file must
% be of the format CIF, QCIF, SIF. It reads nFrame frames.
Y = myfunc_read_cif(nFrame,filename);

% 3D - SPIHT encoder
type = 'bior4.4'; % type of filters for the decomposition
spatial_levels = 3; % levels of decomposition

%---------Wavelet Decomposition-----------------
for i=1:size(Y,3)
    [video_seq(:,:,i) , S] = func_DWT(Y(:,:,i), spatial_levels, type);
end

% maximum bits for the 3D-SPIHT encoding
max_bits = 675840; % for exaple if we have 16 frames each 240x352 and use 0.5 bits per pixel max_bits = 675840
out = func_SPIHT_Enc(video_seq, max_bits,spatial_levels);

% 3D - SPIHT decoder
in = func_SPIHT_Dec(out,size(Y));
video_seq2 = in;
%--------------Wavelet Reconstruction------------
for i=1:size(video_seq2,3)
    Y_new(:,:,i) = func_InvDWT(video_seq2(:,:,i), S, type, spatial_levels);
end


⌨️ 快捷键说明

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