postproc: factor common code