[Spice-devel] [PATCH 0/9] add optional libjpeg-turbo use to spice-server mjpeg encoder

Yonit Halperin yhalperi at redhat.com
Tue Jun 28 11:39:05 PDT 2011

On 06/28/2011 02:18 PM, Christophe Fergeau wrote:
> Hi,
> Currently, the mjpeg encoder has to preprocess the images it gets from
> spice-server to make sure the pixel order is the one libjpeg expects (RGB).
> This means iterating over the whole images swapping pixels since the input
> images are BGR or BGRX.
> However, libjpeg-turbo, in addition to SIMD optimization to JPEG decoding,
> also brings additional input colorspaces, including BGR and BGRX. This patch
> series make use of these new colorspaces in the mjpeg encoder to avoid
> the conversion step.
> libjpeg-turbo use is optional and the code will still do the conversion
> step if libjpeg-turbo wasn't present at compile time. Most of these patches
> are refactoring, the one introducing the libjpeg-turbo code is the one
> before the last.
> Christophe
> Christophe Fergeau (9):
>    red_worker: remove 2 empty functions
>    red_worker: factor pixel conversion code
>    mjpeg_encoder: rework output buffer allocation
>    red_worker: simplify red_rgb_to_24bpp prototype
>    mjpeg_encoder: add mjpeg_encoder_encode_scanline
>    mjpeg_encoder: add mjpeg_encoder_get_bytes_per_pixel
>    red_worker: use new mjpeg_encoder_encode_scanline API
>    mjpeg_encoder: use libjpeg-turbo extra colorspaces
>    mjpeg_encoder: remove unused functions
>   server/mjpeg_encoder.c |  226 +++++++++++++++++++++++++++++++++++++++++-------
>   server/mjpeg_encoder.h |   10 ++-
>   server/red_worker.c    |  178 +++-----------------------------------
>   3 files changed, 213 insertions(+), 201 deletions(-)
server/jpeg_encoder.c can benefit from libjpeg-turbo as well. It is used 
for sending jpeg bitmaps if the client connection is limited (or when 
setting jpeg-wan-compression=always on spice options in qemu command 
line). It suffers from the same BGR->RGB conversions.


More information about the Spice-devel mailing list