Added a limit function and removed a todo and fixed script so that it can actually be run on av1. cherry-picked #1801d35d from aom/master Change-Id: Ib8d1d1b5c7dbe0169e4e6c7d89d28801d7699c37