Composite distance computation.
Computing minimum maching row indexes
Final y distance computation.
Computation of final color distance.