VQ Compression Loop
Assume code book is input
[R] repeat
-- Imput next image, blocked into Im
Disto := dist(CB[0],Im);--Init w/dist entry 1
Coding := 0; --Set coding to 1st
for i := 1 to 255 do --Sweep thru code bk
Distn := dist(CB[i],Im);--dist to ith entry
if Disto > Distn then --Is new dist less?
Disto := Distn; -- Y, update distance
Coding := i; -- record the best
end;
end;
-- Output the compressed image in Coding