Add more assertions to level 3 MV encoding

This should make it harder to introduce desyncs like the one fixed by
by the previous commit.
Fix calculation of MV expectation

We were calculating E(ox) instead of E(abs(ox) - 3 | abs(ox) >= 3) (same
for oy).
Results on video-1-short:
           RATE (%)  DSNR (dB)
    PSNR -0.09505  0.00506
 PSNRHVS -0.10656  0.00841
    SSIM -0.09582  0.00459
FASTSSIM -0.10099  0.00617
Simplify (and improve) the adaptation of MV expectation

Use generic_{encode,decode} to do the adaptation instead of doing it by
hand.
Results on video-1-short:
           RATE (%)  DSNR (dB)
    PSNR -0.01933  0.00103
 PSNRHVS -0.02247  0.00178
    SSIM -0.01943  0.00093
FASTSSIM -0.02078  0.00127
Add check functions for optimized DCT implementations.

Checks are enabled by defining OD_CHECKASM.
doc: fix pdf generation
Use AC_TRY_LINK in tests for intrinics so that a missing intrinsics symbol is noticed.
Add AVX2 intrinsics detection to autotools
Revert Makefile.am changes from previous commit

avx2dct.c is part of a separate patch series, and should have not been included.
Fix AVX2 feature detection
Fix desync by properly clearing mv_grid in the decoder

The desync happens since dd3fca176f087d8fe72ddf2e972d728ef92d941f which
assumes that the grid is cleared. It was reproducable by encoding 16
frames of parkjoy_1080p at -v 50.
upload_commits.sh: Use the full commit message
Enable the SSE2 4x4 IDCT

This should have been enabled earlier but slipped through.
Using finer quantizer for keyframes

Metrics on video-1-short:
           RATE (%)  DSNR (dB)
    PSNR -0.20639  0.01102
 PSNRHVS -0.16628  0.01316
    SSIM -0.20454  0.00984
FASTSSIM -0.22283  0.01366
Adds optional code to measure the actual overhead of the entropy coder
DC RDO using the actual skip probabilities

video-1-short metrics:
           RATE (%)  DSNR (dB)
    PSNR -0.41900  0.02230
 PSNRHVS -0.47261  0.03719
    SSIM -0.54069  0.02580
FASTSSIM -0.34503  0.02112
Remove unused MV visualization code
detailed accounting
More accurate MV rate estimation

This could be even more accurate by making mv_small_rate_est adaptive or
by using a better estimate for the >=3 part of the component magnitudes,
but so far my attempts to do so have only decreased quality.

Results on video-1-short:
           RATE (%)  DSNR (dB)
    PSNR -0.89100  0.04614
 PSNRHVS -1.04905  0.08080
    SSIM -1.09365  0.05120
FASTSSIM -1.30466  0.07874

Results on sintel_trailer_2k_short:
           RATE (%)  DSNR (dB)
    PSNR -4.66465  0.22110
 PSNRHVS -5.80139  0.31411
    SSIM -4.75017  0.16922
FASTSSIM -4.92864  0.21090
Prepare half-pel BMA sad
do fullpell BMA search at halfpel resolution