[x264-devel] commit: Resolve possible crash in bime, improve the fix in r985 ( Jason Garrett-Glaser )

git version control git at videolan.org
Sun Sep 21 22:34:16 CEST 2008


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sun Sep 21 13:35:00 2008 -0700| [24961b015bed5dcda178e683a9f46a4945dc4fe3] | committer: Jason Garrett-Glaser 

Resolve possible crash in bime, improve the fix in r985

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=24961b015bed5dcda178e683a9f46a4945dc4fe3
---

 encoder/me.c        |    2 +-
 encoder/slicetype.c |   11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/encoder/me.c b/encoder/me.c
index 54edc4b..9eb108a 100644
--- a/encoder/me.c
+++ b/encoder/me.c
@@ -854,7 +854,7 @@ int x264_me_refine_bidir( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight
     int bcost = COST_MAX;
     int pass = 0;
     /* each byte of visited represents 8 possible m1y positions, so a 4D array isn't needed */
-    uint8_t visited[8][8][8];
+    DECLARE_ALIGNED_16( uint8_t visited[8][8][8] );
     h->mc.memzero_aligned( visited, sizeof(visited) );
 
     BIME_CACHE( 0, 0 );
diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 06befc6..180448e 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -73,10 +73,13 @@ static int x264_slicetype_mb_cost( x264_t *h, x264_mb_analysis_t *a,
     h->mb.mv_max_fpel[0] = 8*( h->sps->i_mb_width - h->mb.i_mb_x - 1 ) + 4;
     h->mb.mv_min_spel[0] = 4*( h->mb.mv_min_fpel[0] - 8 );
     h->mb.mv_max_spel[0] = 4*( h->mb.mv_max_fpel[0] + 8 );
-    h->mb.mv_min_fpel[1] = -8*h->mb.i_mb_y - 4;
-    h->mb.mv_max_fpel[1] = 8*( h->sps->i_mb_height - h->mb.i_mb_y - 1 ) + 4;
-    h->mb.mv_min_spel[1] = 4*( h->mb.mv_min_fpel[1] - 8 );
-    h->mb.mv_max_spel[1] = 4*( h->mb.mv_max_fpel[1] + 8 );
+    if( h->mb.i_mb_x >= h->sps->i_mb_width - 2 )
+    {
+        h->mb.mv_min_fpel[1] = -8*h->mb.i_mb_y - 4;
+        h->mb.mv_max_fpel[1] = 8*( h->sps->i_mb_height - h->mb.i_mb_y - 1 ) + 4;
+        h->mb.mv_min_spel[1] = 4*( h->mb.mv_min_fpel[1] - 8 );
+        h->mb.mv_max_spel[1] = 4*( h->mb.mv_max_fpel[1] + 8 );
+    }
 
 #define LOAD_HPELS_LUMA(dst, src) \
     { \



More information about the x264-devel mailing list