i am not understanding the dpcm code used for jpeg compression given below.....can anybody help me to explain it?????????
Ältere Kommentare anzeigen
function [r,xtilde]=dpcm(x,a)
% Differential Pulse Coded Modulation
% x: input source vector to be encoded
% a: prediction filter
% r: residue vector quantized to integer if true
% code
end
%
% r(t) = Q[x(t)-xhat(t)] = Q[x(t)- sum a(i)xtilde(t-i)]
% xtilde(t) = xhat(t) + r(t)
%
[m,nx]=size(x);
if min(m,nx) > 1, error('x must be a vector'); return, end
if m==1 & nx > 1, x = x'; m=nx; end % ensure x is a column vector
[p,na]=size(a);
if p==1 & na > 1, a = a'; p=na; end % ensure a is a col. vector
% First p element of x must be sent unchanged as part of r after
% scaler quantization
r=round(x(1:p)); xtilde=r;
for t=p+1:m,
xhat(t)=a'*xtilde(t-1:-1:t-p);
r(t)=round(x(t)-xhat(t));
xtilde(t)=xhat(t)+r(t);
end
1 Kommentar
Walter Roberson
am 25 Jan. 2013
Is there a particular operation you do not understand? Such as what round() does?
Antworten (0)
Kategorien
Mehr zu Audio and Video Data finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!