Big refactor

It seems to have changed something also in the algorithm, but I'm not sure exactly what. I suspect before search was using the source picture instead of the reconstructed one.

Before:

    Processed 10 frames,    5070392 bits AVG PSNR: 42.9749 46.0359 48.0957
    Total time: 21.490 s.

After:

    Processed 10 frames,    5050616 bits AVG PSNR: 42.9777 46.0256 48.0650
    Total time: 21.030 s.