H.264 ground up rewrite, doesn't work