avoid using swscale internals by copying in palette8torbg16 and its bgr variant