From 6df5f6ae51ca3e9f3af760066bc7b3423677a8b4 Mon Sep 17 00:00:00 2001 From: Dan Maas Date: Sat, 25 Feb 2006 22:58:26 +0000 Subject: size[0-3] are not initialized (and can get random negative trash values), so the comparison with vs_total_ac_bits is messed up on the first couple loop iterations, leading to AC underflows. the b->prev[] pointers were not being maintained correctly. We potentially have to update b->prev[] both before and after the area whose VLC length is getting adjusted. this also might fix the ppc regression failure? patch by (Dan Maas ) Originally committed as revision 5064 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/dv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libavcodec/dv.c') diff --git a/libavcodec/dv.c b/libavcodec/dv.c index baf463e75d..9f2cdd8903 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -731,7 +731,7 @@ static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos) int i, j, k, a, prev, a2; EncBlockInfo* b; - size[4]= 1<<24; + size[0] = size[1] = size[2] = size[3] = size[4] = 1<<24; do { b = blks; for (i=0; i<5; i++) { @@ -753,11 +753,14 @@ static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos) prev= k; } else { if(b->next[k] >= mb_area_start[a+1] && b->next[k]<64){ - for(a2=a+1; b->next[k] >= mb_area_start[a2+1]; a2++); + for(a2=a+1; b->next[k] >= mb_area_start[a2+1]; a2++) + b->prev[a2] = prev; assert(a2<4); assert(b->mb[b->next[k]]); b->bit_size[a2] += dv_rl2vlc_size(b->next[k] - prev - 1, b->mb[b->next[k]]) -dv_rl2vlc_size(b->next[k] - k - 1, b->mb[b->next[k]]); + for(; (b->prev[a2]==k) && (a2<4); a2++) + b->prev[a2] = prev; } b->next[prev] = b->next[k]; } -- cgit v1.2.3