[Libav-user] libavcodec/libswscale alignment problem

Camera Man i.like.privacy.too at gmail.com
Mon Jan 23 17:52:08 CET 2012


I did a git pull on a project, and started getting this message:

Warning: data is not aligned! This can lead to a speedloss

This message is uttered by swscale because the U and V pictures are not 
16-byte aligned as required for SSE2, but only 8-byte aligned.

The source code indicates this is a known problem - quoting 
avcodec/utils.c:250-

//STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes
//we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the
//picture size unneccessarily in some cases. The solution here is not
//pretty and better ideas are welcome!
#if HAVE_MMX
     if(s->codec_id == CODEC_ID_SVQ1 || s->codec_id == CODEC_ID_VP5 ||
        s->codec_id == CODEC_ID_VP6 || s->codec_id == CODEC_ID_VP6F ||
        s->codec_id == CODEC_ID_VP6A || s->codec_id == CODEC_ID_DIRAC) {
         for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
             linesize_align[i] = 16;
     }
#endif

Might it be time to bump STRIDE_ALIGN to 16 if SSE2 is supported, as the 
most common use case (swscale) requires it?

Is there anything I can do to fix this without changing STRIDE_ALIGN or 
an upstream change?

Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120123/c953467f/attachment.html>


More information about the Libav-user mailing list