OpenCores
URL https://opencores.org/ocsvn/mdct/mdct/trunk

Subversion Repositories mdct

[/] [mdct/] [trunk/] [MATLAB/] [dctf.m] - Rev 24

Compare with Previous | Blame | View Log

x = [
   139,144,149,153,155,155,155,155;
   144,151,153,156,159,156,156,156;
   150,155,160,163,158,156,156,156;
   159,161,162,160,160,159,159,159;
   159,160,161,162,162,155,155,155;
   161,161,161,161,160,157,157,157;
   162,162,161,163,162,157,157,157;
   162,162,161,161,163,158,158,158;
 
   %255,144,149,153,155,155,155,155;
   %255,151,153,156,159,156,156,156;
   %255,155,160,163,158,156,156,156;
   %255,161,162,160,160,159,159,159;
   %254,160,161,162,162,155,155,155;
   %254,161,161,161,160,157,157,157;
   %254,162,161,163,162,157,157,157;
   %254,162,161,161,163,158,158,158;
 
];
 
% level shift input colors. This will range DC coeff to boundary 9 bits
xn = x-128;
 
%Cm = [
%   C4,  C4,  C4,  C4,  C4,  C4,  C4,  C4;
%   C1,  C3,  C5,  C7, -C7, -C5, -C3, -C1;
%   C2,  C6, -C6, -C2, -C2, -C6,  C6,  C2;
%   C3, -C7, -C1, -C5, -C5,  C1,  C7, -C3;
%   C4, -C4, -C4,  C4,  C4, -C4, -C4,  C4;
%   C5, -C1,  C7,  C3, -C3, -C7,  C1, -C5;
%   C6, -C2,  C2, -C6, -C6,  C2, -C2,  C6;
%   C7, -C5,  C3, -C1,  C1, -C3,  C5, -C7;
%   ];   
 
%Cz = [
%   A,  A,  A,  A,  0,  0,  0,  0;
%   B,  C, -C, -B,  0,  0,  0,  0;
%   A, -A, -A,  A,  0,  0,  0,  0;
%   C, -B,  B, -C,  0,  0,  0,  0;
%   0,  0,  0,  0,  D,  E,  F,  G;
%   0,  0,  0,  0,  E, -G, -D, -F;
%   0,  0,  0,  0,  F, -D,  G,  E;
%   0,  0,  0,  0,  G, -F,  E, -D;
%   ];   
 
Ye = [
   0;
   0;
   0;
   0;
];
 
Yo = Ye;
 
Y = [
   zeros(1,8);
   zeros(1,8);
   zeros(1,8);
   zeros(1,8);
   zeros(1,8);
   zeros(1,8);
   zeros(1,8);
   zeros(1,8);
];
 
Y = dct_func(xn);
Z = dct_func(Y);
 
 
Z
%1/2*Cm*x;
Y;
 
 
Q = [ 16,11,10,16,24,40,51,61;
   12,12,14,19,26,58,60,55;
   14,13,16,24,40,57,69,56;
   14,17,22,29,51,87,80,62;
   18,22,37,56,68,109,103,77;
   24,35,55,64,81,104,113,92;
   49,64,78,87,103,121,120,101;
   72,92,95,98,112,100,103,99   
];
 
N=8;
% quantization
for i = 0:N-1
   for j = 0:N-1
      Zq(i+1,j+1) = round( Z(i+1, j+1)/Q(i+1,j+1));
   end
end
 
Zq;
 
 
 
 
 
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.