j2k/jpeg2000: merge pix_fmt setting code

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