Speed up video_gauge

Also re-implemented video_gauge_long.

Added tests for both
Merge pull request #765 from pculture/dbtuning3

Speed up video_gauge