-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test_2DDCT_Speed.m
52 lines (39 loc) · 1.72 KB
/
Test_2DDCT_Speed.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
41
42
43
44
45
46
47
48
49
50
51
52
%=================================================================================
% Advanced Multimedia Applications
% Title : 2D-DCT Speed Test (Test_2DDCT_Speed.m)
% Description : Test Script for 2D_DCT - to measure speed between the
% row and column wise 2D-DCT and the 2D-DCT using basic
% transform equations.
%=================================================================================
clc;clear;close all;
%=====================================================================
% T E S T - S C R I P T P A R A M E T E R S
%=====================================================================
max_datasize = 128; % maximum datasize to check
speed = 0; %(using simple, 1D-DCT equation on rows and colums)
%=====================================================================
% T E S T - M A I N L O O P
%=====================================================================
i=1;
for datasize=8:8:max_datasize
% the data - a random matrix
data = round(-128 + (128+128).*rand(datasize,datasize))';
% perform the 2D-DCT - using the 2D-DCT basic transform equation
tstart = tic;
dct2_s = dct_2_simple(data);
telapsed_dct2_s(i) = toc(tstart);
% perform the 2D-DCT - using 1D-DCT transform equations
% rows first then columns.
tstart = tic;
dct2_rc = dct_2_8x8(data,datasize,speed)';
telapsed_dct2_rc(i) = toc(tstart);
i=i+1;
display(['Finished Test, datasize=',num2str(datasize)])
end
% display speed results on graph
% plot in logarithmic scale
datasize=[8:8:max_datasize];
semilogy(datasize,telapsed_dct2_rc,'b');
hold on;
semilogy(datasize,telapsed_dct2_s,'r');
grid on;