The mechanism of charge density wave in Pt-based layered superconductors: SrPt2As2 and LaPt2Si2