avcodec/mjpegdec: check bits per pixel for changes similar to dimensions