Refactor internal stats code

Ported from libvpx/nextgenv2: 1a69cb2

Change-Id: Icec13798d8cf2f00b78de16c642dd2aa754ba826
3 files changed