aacenc: reduce the number of loop index variables