Dynamic theory of picosecond optical pulse shaping by gain-switched semiconductor laser amplifiers