]> granicus.if.org Git - libvpx/commitdiff
changed to comply with strict aliasing rule
authorYaowu Xu <yaowu@google.com>
Mon, 28 Oct 2013 16:02:42 +0000 (09:02 -0700)
committerYaowu Xu <yaowu@google.com>
Tue, 29 Oct 2013 18:34:19 +0000 (11:34 -0700)
The clamp operation may not affect the values of the final assigned mv
where compiler may make use of strict aliasing rule to optimize out the
clamp operation. This change made the code segments to better comply
the strict aliasing rule.

Change-Id: I24502ff18bd4f9e62507a879cc8760a91a0fd07e

vp8/decoder/decodemv.c

index 8027a07ed44a671213355b75bbbf255cd75be35f..4327d3b123327fe0a21ba3697200225111355c5c 100644 (file)
@@ -512,15 +512,15 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi)
                 else
                 {
                     mbmi->mode =  NEARMV;
-                    vp8_clamp_mv2(&near_mvs[CNT_NEAR], &pbi->mb);
                     mbmi->mv.as_int = near_mvs[CNT_NEAR].as_int;
+                    vp8_clamp_mv2(&mbmi->mv, &pbi->mb);
                 }
             }
             else
             {
                 mbmi->mode =  NEARESTMV;
-                vp8_clamp_mv2(&near_mvs[CNT_NEAREST], &pbi->mb);
                 mbmi->mv.as_int = near_mvs[CNT_NEAREST].as_int;
+                vp8_clamp_mv2(&mbmi->mv, &pbi->mb);
             }
         }
         else