It takes each piece that is over the cap, discards materia, and scales the stats down to the stats for an item of the cap level. Gear pieces that are naturally under the cap keep their materia.