lavc: add a convenience function for rescaling timestamps in a packet
Use av_packet_rescale_ts() to simplify code.
dvenc: initialize the profile only once, at init

We do not allow the frame parameters to change during encoding, so there
is no need to do this for each frame.
dv: get rid of global non-const tables

Instead, store them in the context and compute on each parameter change.
dv: cosmetics, reindent