diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-22 21:32:05 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-22 21:32:11 +0100 |
commit | b429440d857e01250666ed1a68c86c77e575b9ee (patch) | |
tree | 44dcb1af9aee050e0b41ec0a5fd141f1a6500730 | |
parent | 6161c41817f6e53abb3021d67ca0f19def682718 (diff) | |
parent | ea0323b0fad2a0f2884329105a52f694f3a327cd (diff) | |
download | ffmpeg-b429440d857e01250666ed1a68c86c77e575b9ee.tar.gz |
Merge remote-tracking branch 'shariman/wmall'
* shariman/wmall:
call revert_cdlms()
Fix some loop conditions to prevent overreads
Initialize pred in lms_predict()
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/wmalosslessdec.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index a26c2a7244..42ff5838cb 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -789,7 +789,7 @@ static void reset_codec(WmallDecodeCtx *s) static int lms_predict(WmallDecodeCtx *s, int ich, int ilms) { - int32_t pred, icoef; + int32_t pred = 0, icoef; int recent = s->cdlms[ich][ilms].recent; for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) @@ -857,7 +857,7 @@ static void use_high_update_speed(WmallDecodeCtx *s, int ich) { int ilms, recent, icoef; s->update_speed[ich] = 16; - for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) { + for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) { recent = s->cdlms[ich][ilms].recent; if (s->bV3RTM) { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) @@ -873,7 +873,7 @@ static void use_normal_update_speed(WmallDecodeCtx *s, int ich) { int ilms, recent, icoef; s->update_speed[ich] = 8; - for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) { + for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) { recent = s->cdlms[ich][ilms].recent; if (s->bV3RTM) { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) @@ -901,7 +901,7 @@ static void revert_cdlms(WmallDecodeCtx *s, int tile_size) s->transient[ich] = 1; use_high_update_speed(s, ich); } - for (ilms = num_lms; ilms >= 0; ilms--) { + for (ilms = num_lms - 1; ilms >= 0; ilms--) { pred = lms_predict(s, ich, ilms); channel_coeff += pred; lms_update(s, ich, ilms, channel_coeff, pred); @@ -1044,6 +1044,7 @@ static int decode_subframe(WmallDecodeCtx *s) if(s->is_channel_coded[i]) decode_channel_residues(s, i, subframe_len); } + revert_cdlms(s, subframe_len); /** handled one subframe */ |