aboutsummaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorDan Maas2006-02-25 22:58:26 +0000
committerMichael Niedermayer2006-02-25 22:58:26 +0000
commit6df5f6ae51ca3e9f3af760066bc7b3423677a8b4 (patch)
treeddcc331b7678c8800ff74397d9701d956de6d421 /libavcodec
parent1bd8624697c1377bf42f5aef4795a370c3b01c1d (diff)
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 <dmaas maasdigital com>) Originally committed as revision 5064 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dv.c7
1 files changed, 5 insertions, 2 deletions
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];
}