[Spice-devel] [spice-server PATCH v1 4/12] mjpeg_encoder: fix alignment warnings (pixel_converter)

Frediano Ziglio fziglio at redhat.com
Wed Aug 12 07:21:19 PDT 2015


> 
> Hi,
> 
> On Wed, Aug 12, 2015 at 01:45:52PM +0200, Christophe Fergeau wrote:
> > On Wed, Aug 12, 2015 at 07:01:40AM -0400, Frediano Ziglio wrote:
> > > Not sure about it. Lines came from spice_bitmap_get_line. This
> > > function assume that bitmap data is split among chunks each containing
> > > some lines (always full lines). If chunk->data is allocated using
> > > malloc or similar SHOULD (not 100% sure) be 4 bytes aligned so in our
> > > cases (8, 16, 24 or 32 bit images) should be aligned enough.
> > >
> > > All the casts unfortunately came from the fact we compute based on
> > > pixel bytes to make it generic so we use uint8_t* but clang complaints
> > > (well, that's why there are explicit casts, to make compiler aware we
> > > know we are doing the right thing).
> >
> > Ah well, I mixed src_ptr and dest when taking a look ;) dest is
> > definitely not aligned, but only byte accesses are done on it so it does
> > not matter.
> > All of your explanation belongs in the commit log though, so that we
> > remember what was our reasoning at the time if this turns out to be a
> > problem in the future.
> 
> Sure, I can put Frediano's explanation on the commit log. I'm trying to
> figure out a few things unrelated to this series but I'll resend it
> again soon.
> 
> Thanks for taking time to review it,
>   toso
> 
> >
> > Christophe
> 
> 

There is still one missing thing to check, that chunk->data is correctly aligned!

Frediano


More information about the Spice-devel mailing list