From 1b68cbd27b24759f64c72effdae42f184a20546e Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 31 Dec 2009 02:57:45 -0500 Subject: [PATCH] Fix some invalid reads caught by valgrind Temporal predictor calculation was misled by invalid reference counts for I-frames. --- encoder/encoder.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index 6c57840d..5de6bdc0 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -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 ) -- 2.47.3