Segment labeling front-end based on the Berkley BSR code