Normalize an array of periods.
The input periods may overlap and may be non contiguous. The normalized periods are new periods that must be freed.