Code covered by the BSD License  

Highlights from
1D DCT

1D DCT

by

 

this function implement the 1d dct by lofflers algorithm

DCT(v)
%le vecteur d'entree

function y = DCT(v)
     

C3 = [0 0] ;
C1 = [0 0] ;
C6 = [0 0] ;
%bolck 1

som10 = v(1) + v(8) ;
som11 = v(2) + v(7);
som12 = v(3) + v(6);
som13 = v(4) + v(5);
sou10 = v(4) - v(5);
sou11 = v(3) - v(6);
sou12 = v(2) - v(7);
sou13 = v(1) - v(8);

%block 2

som20 = som10 + som13;
som21 = som11 + som12;
sou20 = som11 - som12;
sou21 = som10 - som13;

    %C3

    a = cos(3*pi/16) ;  
    b = sin(3*pi/16)  ;
    c = b- a ;
    d = -( a + b ) ;
    E= (sou10 + sou13 )*a;
    
C3(1) = c*sou13 +  E ;
C3(2) = d*sou10 +  E ;

    %C1
    a = cos(pi/16) ;  
    b = sin(pi/16)  ;
    c = b- a ;
    d = -( a + b ) ;
    E= (sou11 + sou12 )*a;
    
C1(1) = c*sou12 +  E ;
C1(2) = d*sou11 +  E ;

% block 3

som30 = som20 + som21 ;
sou30 = som20 - som21 ;

    %sqrt(2)C6
    s= sqrt(2);
    a = s*cos(6*pi/16) ;  
    b = s*sin(6*pi/16)  ;
    c = b - a    ;
    d = -( a + b ) ;
    E= (sou20 + sou21 )*a;
    
C6(1) = c*sou21 +  E ;
C6(2) = d*sou20 +  E ;

som31= C3(1) + C1(2);
sou31= C3(2) - C1(1);
som32= C3(2) + C1(1);
sou32= C3(1) - C1(2);


% block 4

som4 = som31 + som32 ;
sou4 = -som31 + som32 ;

 y = [som30 som4 C6(1) s*sou31 sou30 s*sou32 C6(2) sou4]*1/(2*s);



Contact us