Coupling the mechanics and energetics of bird and insect flight