No BSD License  

Highlights from
Scalable MPEG compression based on DCT coefficients

Scalable MPEG compression based on DCT coefficients

by

 

15 Nov 2006 (Updated )

This application makes 2 layers base Layer and enhancement layer from quantized coefficients

makeLayers(c)
function [X,B,DC]= makeLayers(c)


%I=imread('cameraman.tif');
%I=dct2(I);
scanzz=zeros(8,8);
%enhansLayer=zeros(8,8);
b=1;
l=1;
v=0;
cSize=size(c);
Blimit=63;
limit=6;
%Elimit=53;
for i=1:8:cSize(1,1)
    for j=1:8:cSize(1,2)
        v=v+1;
        ii=1;
        scanzz=zigzag(c(i:i+7,j:j+7));
        DC(v)=scanzz(1);
        x=scanzz(2:64);
        [y index] = sort(abs(x));
        y(1:63) = y(63:-1:1);
        index(1:63) = index(63:-1:1);
        y(ii:length(index)) = x(index(ii:length(index)));
        y(1:limit)=y(1:limit);
        y(limit+1:63)=0;
        xold(index(1:63)) = y(1:63);
%         xold(1:10)=xold(1:10);
%         xold(11:63)=0;

        baseLayer(v,1:63) = xold(1:63);

             
    end
end
B=[];
zzBSize=size(baseLayer);
for i=1:zzBSize(1,1)
    [val,run]=rle(baseLayer(i,1:Blimit));
    temp = huffEncode1(val,run);
    B=[B temp];
end
% E=[];    
% zzESize=size(enhansLayer);
% for i=1:zzESize(1,1)
%     [val,run]=rle(enhansLayer(i,1:Elimit));
%     temp = huffEncode1(val,run);
%     E=[E temp];
% end

dcSize=length(DC);
diffDC(1)=DC(1);
for i=2:dcSize
    diffDC(i)=DC(i)-DC(i-1);
end

X=huffEncodeDC(diffDC);





%layer=deRunLength(diffDC,valVectorBase,lenVectorBase,valVectorEnhan,lenVectorEnhan);
%figure;imshow(layer)
% diffDC(1)=baseLayer(1,1);
% for i=2:1024
%     diffDC(i)=baseLayer(i,1)-baseLayer(i-1,1);
% 
%     [val len]=rle(baseLayer(i,2:20));
%     
%     valVectorBase(i-1,1:19)=val;
%     lenVectorBase(i-1,1:19)=len;
% end
% for i=1:1024
%     [val len]=rle(enhansLayer(i,1:44));
%     size(val)
%     valVectorEnhan(i,1:44)=val;
%     lenVectorEnhan(i,1:44)=len;
% end
%     

Contact us