refactor ME for easier adding other search methods

reviewed at https://rbcommons.com/s/OpenH264/r/188/