Polarons and bipolarons in high-Tc superconductors and related materials