[Spice-devel] [spice-common] Some steps toward quic_tmpl.c and quic_rgb_tmpl.c 'unification'

Christophe Fergeau cfergeau at redhat.com
Wed Jul 5 08:20:34 UTC 2017


Hey,

This is a v2 of the initial 2 patches, but looking a bit closer at the quic
code led me down a rabbit hole ;) We currently have 2 different quic
implementations using the preprocessor as a template engine. These 2
implementations are quic_tmpl.c which handles 1 byte and 4 bytes images,
and the quic_rgb_tmpl.c which handles 24bpp/32bpp/16bpp images.

The main difference is that the former implementation handles a single channel,
while the rgb implementation handles each color component separately. Besides that,
the implementation is the same, but this is not obvious at all by just comparing the
2 files. This patch series makes the 2 files closer, but not easily mergeable yet ;)

The biggest pending difference is that quic_tmpl.c carries around a 'channel'
with the data it needs, while quic_rgb_tmpl.c iterates over Encoder::channels
when needed.

This imo does not justify duplicating that much code, but I don't want to spend
too much time on quic either, so I'll stop there for now :)

I've only tested the RGB32 case, as I'm not sure how to trigger the 1 byte or 4
byte code paths (I've tried win7 and fedora 25 guests so far).

Christophe



More information about the Spice-devel mailing list