Energy-efficient sludge treatment