avcodec/huffyuvenc: Factorize store_huffman_tables() out

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>