Energy Dependence of Isospin Mixing in the Giant-Dipole States ofC12andO16