[FFmpeg-trac] #7226(avfilter:new): Generic vf_blend implementation contains unaligned memory access

FFmpeg trac at avcodec.org
Wed May 23 22:14:06 EEST 2018


#7226: Generic vf_blend implementation contains unaligned memory access
------------------------------------+------------------------------------
             Reporter:  Lastique    |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avfilter
              Version:  git-master  |               Resolution:
             Keywords:  vf_blend    |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by Lastique):

 > We have AV_R* and AV_W* macros in libavutil/intreadwrite.h for unaligned
 reads and writes.

 Thanks, I didn't know about the macros. I've attached an updated patch.
 Unfortunately, I had to expand `DEFINE_BLEND_EXPR` as I could not use the
 macros from it.

 I also corrected a minor oversight in that `A` and `B` macros were still
 referencing the data through pointers instead of using the loaded values.
 I guess, the compiler optimized away these references.

 > That being said, the fact the build system forcefully disables
 vectorization should serve as a hint that it's done for a reason.

 The only reason I found was [https://ffmpeg.org/pipermail/libav-
 user/2013-February/003867.html this] thread from back 2013. Things could
 have change since then.

 Anyway, auto-vectorization is not the problem, it merely exposed the bug.

 > The -cpuflags option lets you choose which intruction sets you want to
 enable, so "-cpuflags none" will make sure no asm optimized function is
 used, outside of stuff hardcoded at compile time.

 Ok, but ffmpeg will probably align the buffers. The test specifically
 tests with misaligned pointers.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7226#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list