calculate byte frequencies