Real-time digital signal processing for coherent reception and its application to optical communications