|
input : A synchronized video pair A, B; minimal discovery length ℓ; commonality period T
|
|
output: Optimal intervals r* = [b1, e1, b2, e2] |
1
|
L ← T + ℓ; // The largest possible searching period |
2
|
Q ← empty priority queue; // Initialize priority queue Q |
3
|
for
t ← 0 to (n – L) do
|
4
|
R ← [1 + t, L + t, 1 + t, L + t]; // Diagonal regions |
5
|
Q.push(bound(R), R); // Fill in Q |
6
|
end
|
7
|
R ← Q.pop(); // Initialize R |
8
|
while |R| ≠ 1 do
|
9
|
R → R′ U R″; // Split into 2 disjoint sets |
10
|
Q.push(bound(R′), R′); // Push R′ and its bound |
11
|
Q.push(bound(R″), R″); // Push R″ and its bound |
12
|
R ← Q.pop(); // Pop top state from Q |
13
|
end
|
14
|
r* ← R; // Retrieve the optimal rectangle |