vp78: Don't use AV_WN32A on possibly unaligned pointers

Message ID 1397464900-24080-1-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö April 14, 2014, 8:41 a.m.
This hopefully fixes the vp7 fate test on sparc.
---
None of the current vp8 fate tests trigger these codepaths.
---
 libavcodec/vp8.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Kostya Shishkov April 14, 2014, 8:46 a.m. | #1
On Mon, Apr 14, 2014 at 11:41:40AM +0300, Martin Storsjö wrote:
> This hopefully fixes the vp7 fate test on sparc.
> ---
> None of the current vp8 fate tests trigger these codepaths.
> ---
>  libavcodec/vp8.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> index e73ee82..2445b2e 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -1151,7 +1151,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
>              const uint32_t modes = (is_vp7 ? vp7_pred4x4_mode
>                                             : vp8_pred4x4_mode)[mb->mode] * 0x01010101u;
>              if (s->mb_layout == 1)
> -                AV_WN32A(mb->intra4x4_pred_mode_top, modes);
> +                AV_WN32(mb->intra4x4_pred_mode_top, modes);
>              else
>                  AV_WN32A(s->intra4x4_pred_mode_top + 4 * mb_x, modes);
>              AV_WN32A(s->intra4x4_pred_mode_left, modes);
> @@ -2158,8 +2158,8 @@ void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe,
>          s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
>          for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
>              if (mb_y == 0)
> -                AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top,
> -                         DC_PRED * 0x01010101);
> +                AV_WN32((mb - s->mb_width - 1)->intra4x4_pred_mode_top,
> +                        DC_PRED * 0x01010101);
>              decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,
>                             prev_frame && prev_frame->seg_map ?
>                             prev_frame->seg_map->data + mb_xy : NULL, 1, is_vp7);
> -- 

looks OK

Patch

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index e73ee82..2445b2e 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -1151,7 +1151,7 @@  void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
             const uint32_t modes = (is_vp7 ? vp7_pred4x4_mode
                                            : vp8_pred4x4_mode)[mb->mode] * 0x01010101u;
             if (s->mb_layout == 1)
-                AV_WN32A(mb->intra4x4_pred_mode_top, modes);
+                AV_WN32(mb->intra4x4_pred_mode_top, modes);
             else
                 AV_WN32A(s->intra4x4_pred_mode_top + 4 * mb_x, modes);
             AV_WN32A(s->intra4x4_pred_mode_left, modes);
@@ -2158,8 +2158,8 @@  void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe,
         s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
         for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
             if (mb_y == 0)
-                AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top,
-                         DC_PRED * 0x01010101);
+                AV_WN32((mb - s->mb_width - 1)->intra4x4_pred_mode_top,
+                        DC_PRED * 0x01010101);
             decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,
                            prev_frame && prev_frame->seg_map ?
                            prev_frame->seg_map->data + mb_xy : NULL, 1, is_vp7);