WebP: refactor inverse prediction to remove code duplication