Charged pion spectra and energy transfer following antiproton annihilation at rest in carbon and uranium