Determination of local high-frequency dielectric function during the cubic-to-tetragonal phase transformation in barium titanate