[FFmpeg-devel] [PATCH] Fix unaligned fill_rectangle in rv34.c

Reimar Döffinger Reimar.Doeffinger
Thu Aug 20 09:57:32 CEST 2009

On Thu, Aug 20, 2009 at 10:33:19AM +0300, Kostya wrote:
> On Thu, Aug 20, 2009 at 09:14:54AM +0200, Reimar D?ffinger wrote:
> > Hello,
> > rv34.c uses fill_rectangle with only 4 bytes alignment, which causes
> > crashes on 64 bit architectures without unaligned read support like
> > Sparc/Solaris.
> > This patch hacks rectangle.h to support this kind of use - this
> > seemed the simplest, even though rather hackish, way to me.
> May I add that it happens when zeroing motion vectors for some
> macroblock, i.e. where there will be non-64bit align for sure.

Huh? I tested it, and it fixes the issues at least with the FATE sample
file, completely.
motion_val is int16_t and the indexes used for fill_rectangle are all
a multiple of 2 (though why the code uses
s->mb_x * 2 + s->mb_y * 2 * s->b8_stride
instead of
(s->mb_x + s->mb_y * s->b8_stride) << 1
is beyond me).

> Probably better solution would be to disable this code automatically for
> such archs. I don't remember an outcome of my discussion with Mans
> about that though.

Don't see any need for it, AFAICT only the 64 bit writes are an issue
and I am not convinced they are that much of an advantage.

More information about the ffmpeg-devel mailing list