Fix reference frame size restrictions.

The issue was introduced by commit g9f37d14 with adding explicit
restrictions on reference-frame scale factors. The restriction
is checked against aligned-by-8 frame dimensions, not against
original ones. So, for example, frame of 35×35 actually can refer
to frame of 70×70, but the new check won't allow this. It will
compare 35 vs 72 (not 70), so 2x downscale limit will be exceeded.

Change-Id: Ic663693034440f64ac8312cbff9e1e773a921060
Store block-wise statistics obtained in the first pass

Change-Id: I9956db2ba2f7d28f484daaf5022d8d1ef5db473c
Merge "Fix reference frame size restrictions."
Merge "Store block-wise statistics obtained in the first pass"
Fix bug 805

Remove all the redundant dct functions (dct4x4, dct8x8)
in avx2 except dct32x32 those functions were copied originally from dct_sse2

Change-Id: I742576fbf5175f3ac09f2076976a9247b259323e