-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathminCost.m
More file actions
33 lines (24 loc) · 706 Bytes
/
Copy pathminCost.m
File metadata and controls
33 lines (24 loc) · 706 Bytes
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
% Finds the indices of the cell that holds the minimum cost
%
% Input
% costs : The matrix that contains the estimation costs for a macroblock
%
% Output
% dx : the motion vector component in columns
% dy : the motion vector component in rows
%
function [dx, dy, min] = minCost(costs)
[row, col] = size(costs);
% we check whether the current
% value of costs is less then the already present value in min. If its
% inded smaller then we swap the min value with the current one and note
% the indices.
min = 65537;
for i = 1:row
for j = 1:col
if (costs(i,j) < min)
min = costs(i,j);
dx = j; dy = i;
end
end
end