red_worker: factor pixel conversion code
red_worker: factor pixel conversion code

When encoding to mjpeg, the on screen data have to be converted
to 24bpp RGB since that's the format that libjpeg expects. Factor
as much code as possible for the 3 formats we handle.

mathslinux/spice,elmarco/spice,mathslinux/spice,dezelin/spice,dezelin/spice,ya-mouse/spice,alon/spice-server,alon/spice-server,fgouget/spice,freedesktop-unofficial-mirror/spice__spice,alon/spice-server,dezelin/spice,freedesktop-unofficial-mirror/spice__spice,elmarco/spice,Fantu/spice,freedesktop-unofficial-mirror/spice__spice,ya-mouse/spice,fgouget/spice,dezelin/spice,Fantu/spice,ya-mouse/spice,fgouget/spice,freedesktop-unofficial-mirror/spice__spice,freedesktop-unofficial-mirror/spice__spice,mathslinux/spice,elmarco/spice,Fantu/spice,SPICE/spice,SPICE/spice,Fantu/spice,SPICE/spice,elmarco/spice,mathslinux/spice,alon/spice-server,mathslinux/spice,dezelin/spice,elmarco/spice,alon/spice-server,fgouget/spice