refactoring libwebp API