encoder: range check number of NAL units
Merge HPEL interpolations with the same HPEL offsets

In the square1[9], the candidate HPEL offsets are:

 5 1 7
 3 x 4
 6 2 8

The main idea is two HPEL distances makes one FPEL so we can merge 1-2, 3-4,
5-6, and 7-8 into one interpolation each by adding 1 extra row/col to the
interpolation
encoder: disable lookahead for all-intra encodes

This works around a bug in the current Lookahead::slicetypeDecide().  I have
a patch in the works which fixes this properly, but I think this is a reasonable
workaround.  Tested with ABR and it works ok.
fix hash mistake from --sao-lcu-opt=0 --frame-threads 2

Delay all deblock and SAO until the entire frame is available.  Frame SAO and
frame parallelism will now generate correct results, but it will have very poor
performance, so the hard check is relaxed to a warning.
Avoid VS2008 X64 compiler bug
Merge with stable
Added support for multiple references

Added a commandline parameter '--ref <max number of references>'. DPB size
adjusted to use number of references.