-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest_1D_DCT.m
40 lines (32 loc) · 1.26 KB
/
Test_1D_DCT.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
%=================================================================================
% Advanced Multimedia Applications
% Title : Test Script for Simple and Fast DCT (1D) (Test_1D_DCT.m)
% Description : Testing using a random 8 sample array.
% Checking time taken by each function
%=================================================================================
clear;clc;
% -------- simple 1D-DCT --------
data = [-88 121 113 3 66 -13 -50 77]% original input data
datasize = 8; % number of data items
%data = round(-128 + (128+128).*rand(datasize,1))'
tic % start timer
dct_coeffs = dct_1(data) % perform 1D-DCT
idata = round(idct_1(dct_coeffs)) % perform 1D-IDCT
toc % stop timer
% check if original data is the same as reconstructed data
if(any(data == round(idata)))
fprintf('1D-DCT successful\n');
else
fprintf('1D-DCT unsuccessful\n');
end
% -------- simple 1D-FDCT --------
tic % start timer
fdct_coeffs = fdct_1(data); % perform 1D-FDCT
idata = fidct_1(fdct_coeffs); % perform 1D-IDCT
toc % stop timer
% check if original data is the same as reconstructed data
if(any(data == round(idata)))
fprintf('1D-FDCT successful\n');
else
fprintf('1D-FDCT unsuccessful\n');
end