Add variance restriction to AQ2.

Add an additional restriction to bit/complexity based
segmentation based on spatial variance.

Only lower Q when both the number of bits spent
in the initial encoding pass and the spatial complexity are
below a threshold. This will prevent the low Q segments
being used just because there is a surfeit of bits.

Small metrics gains especially opsnr.
derf ~0.2% std-hd ~0.3%

Change-Id: I6a8496d466d673f9b0e2b2ca6304ea7b6d8e1cce
Add adaptive midpoint for AQ1.

Make the midpoint variance used in AQ mode 1 segmentation
depend on the overall complexity of the frame in two pass.

Change-Id: I452814ec57f7a32352e41bb250e78066abe952dd
Switch AQ1 segment basis from q ratio to rate ratio.

In defining the Q deltas for segments in AQ1 use a rate
ratio rather than a q ratio.

Change-Id: Id31a74fcf2b7e55437e42a51c21b3cbcb57028d4
Remove rate component adjustment for AQ1

In AQ1 a rate adjustment was applied for blocks coded with a
deltaq. This tends to skew the partition selection and cause
rate overshoot.

For example, consider a 64x64 super block where some but not all
sub blocks are in a low q segment and some are in a high q segment.
The choice of Q when considering large partition and transform sizes
is defined by the lowest sub block segment id (currently this implies the
lowest Q). If some parts of the larger partition are very hard this will
cause a high rate component.

The correct behavior here is for the rd code to discard the large partition
choice and break down to sub blocks where some have low and some
have high Q.  However the rate correction factor above mask the high
cost of coding at a larger partition size.

Change-Id: Ie077edd0b1b43c094898f481df772ea280b35960
Merge "Add variance restriction to AQ2."
Merge "Add adaptive midpoint for AQ1."
Merge changes Ie077edd0,Id31a74fc

* changes:
  Remove rate component adjustment for AQ1
  Switch AQ1 segment basis from q ratio to rate ratio.