Electronic structures and optical dielectric functions of room temperature phases of SrTiO3 and BaTiO3