]> git.videolan.org Git - x264.git/commitdiff
Fix some invalid reads caught by valgrind
authorJason Garrett-Glaser <darkshikari@gmail.com>
Thu, 31 Dec 2009 07:57:45 +0000 (02:57 -0500)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Thu, 14 Jan 2010 04:46:57 +0000 (23:46 -0500)
Temporal predictor calculation was misled by invalid reference counts for I-frames.

encoder/encoder.c

index 6c57840d9e44be16eb6fdab744e7393c0a56052d..5de6bdc06837de0c87c1ee56174e801ac498a81b 100644 (file)
@@ -1339,8 +1339,11 @@ static inline void x264_reference_build_list( x264_t *h, int i_poc )
     int b_ok;
 
     /* build ref list 0/1 */
-    h->i_ref0 = 0;
-    h->i_ref1 = 0;
+    h->mb.pic.i_fref[0] = h->i_ref0 = 0;
+    h->mb.pic.i_fref[1] = h->i_ref1 = 0;
+    if( h->sh.i_type == SLICE_TYPE_I )
+        return;
+
     for( i = 0; h->frames.reference[i]; i++ )
     {
         if( h->frames.reference[i]->i_poc < i_poc )