Assorted minor optimizations to video code