[FFmpeg-devel] [PATCH] Fix unaligned access in lcl decoder
Fri May 29 18:40:13 CEST 2009
Jeff Downs <heydowns at borg.com> writes:
> On Thu, 28 May 2009, M?ns Rullg?rd wrote:
>> Jeff Downs <heydowns at borg.com> writes:
>> > It looks fine. It expands to:
>> > (((struct unaligned_32 *) (destptr))->l) =
>> > ((((const struct unaligned_32 *) (srcptr))->l));
>> That's what it does with gcc. With the shift/or variant it will be
>> something much uglier.
> If that is the case, then should the macro definitions be fixed? The
> read/write pairing is used elsewhere (dsputil.h).
Those macros are meant for reading *or* writing a value to an
unaligned location. When copying, there is no need to shift/or the
bytes into a 32-bit value only to take it apart again for storing.
This means that sometimes those macros are good for copying, while
other times (when shift/or is used) bytewise copying would be better.
Perhaps we need a dedicated macro for copying small unaligned
quantities. In theory, compilers should optimise memcpy()
appropriately, but somehow I don't them.
mans at mansr.com
More information about the ffmpeg-devel