You are on page 1of 1

An Improvement to JPEG Compression

On the assumption that


a certain 8􀁨8 matrix transformed by the discrete cosine and
quantized is called I.

**** THE REMAINING PART IS SIMILAR TO OLD ALGORITMS


[m,n]=size(I); % Obtain the length and the breadth of
the matrix
p1=1;
s=m*n;
for k=1:m
for h=1:n
f=0;
for b=1:p1-1
if(c(b,1)==I(k,h)) f=1;break;end
end
if(f==0) c(p1,1)=I(k,h);p1=p1+1;end %C is used
to store all possible values
end
end
for g=1:p1-1
p(g)=0;c(g,2)=0;
for k=1:m
for h=1:n
if(c(g,1)==I(k,h)) p(g)=p(g)+1;end
end
end
p(g)=p(g)/s; % P is used to store the corresponding
probability
end

You might also like