[FFmpeg-devel] [PATCH/RFC] Fix unaligned accesses in RV3/4 decoders

Michael Niedermayer michaelni
Mon Jun 29 19:46:45 CEST 2009


On Mon, Jun 29, 2009 at 11:15:12AM +0100, Mans Rullgard wrote:
> rv34_decode_mb_header() calls fill_rectangle() with an unaligned
> destination, causing errors on some platforms.
> 
> This change, suggested by Kostya, fixes it, and regression tests pass.
> ---
>  libavcodec/mpegvideo.c |    2 +-
>  libavcodec/rv34.c      |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
> index 35cde71..6215c72 100644
> --- a/libavcodec/mpegvideo.c
> +++ b/libavcodec/mpegvideo.c
> @@ -471,7 +471,7 @@ av_cold int MPV_common_init(MpegEncContext *s)
>      s->mb_width  = (s->width  + 15) / 16;
>      s->mb_stride = s->mb_width + 1;
>      s->b8_stride = s->mb_width*2 + 1;
> -    s->b4_stride = s->mb_width*4 + 1;
> +    s->b4_stride = s->mb_width*4 + 4;
>      mb_array_size= s->mb_height * s->mb_stride;
>      mv_table_size= (s->mb_height+2) * s->mb_stride + 1;

id say rv* could use 4*mb_stride if it wants it aligned, that said iam not
against the patch, and if we decide to go the way of the patch, the
field in the struct should be documented to now gurantee that alignment


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090629/23170096/attachment.pgp>



More information about the ffmpeg-devel mailing list