summaryrefslogtreecommitdiffstats
path: root/libavcodec/wmalosslessdec.c
diff options
context:
space:
mode:
authorMashiat Sarker Shakkhar <shahriman_ams@yahoo.com>2011-12-02 16:24:50 +0600
committerMashiat Sarker Shakkhar <shahriman_ams@yahoo.com>2011-12-02 16:24:50 +0600
commit460bec6800f6229b664297a6c83a5ef4f0701221 (patch)
tree39b52c137796319c2b71263fff7750ecc1c07419 /libavcodec/wmalosslessdec.c
parent075ebdf73563084bb35f5853ff661ed16a4819f1 (diff)
downloadffmpeg-streaming-460bec6800f6229b664297a6c83a5ef4f0701221.zip
ffmpeg-streaming-460bec6800f6229b664297a6c83a5ef4f0701221.tar.gz
Fix lms_update()
Diffstat (limited to 'libavcodec/wmalosslessdec.c')
-rw-r--r--libavcodec/wmalosslessdec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index cdaf2f3..90a2c97 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -891,21 +891,23 @@ static int lms_predict(WmallDecodeCtx *s, int ich, int ilms)
return pred;
}
-static void lms_update(WmallDecodeCtx *s, int ich, int ilms, int16_t input, int16_t pred)
+static void lms_update(WmallDecodeCtx *s, int ich, int ilms, int16_t residue, int16_t pred)
{
int16_t icoef;
int recent = s->cdlms[ich][ilms].recent;
int16_t range = (1 << s->bits_per_sample - 1) - 1;
int bps = s->bits_per_sample > 16 ? 4 : 2; // bytes per sample
+ int16_t input = residue + pred;
- if (input > pred) {
+ if (residue > 0) {
for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
s->cdlms[ich][ilms].coefs[icoef] +=
s->cdlms[ich][ilms].lms_updates[icoef + recent];
} else {
for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
s->cdlms[ich][ilms].coefs[icoef] -=
- s->cdlms[ich][ilms].lms_updates[icoef]; // XXX: [icoef + recent] ?
+ s->cdlms[ich][ilms].lms_updates[icoef + recent]; /* spec mistakenly
+ dropped the recent */
}
s->cdlms[ich][ilms].recent--;
s->cdlms[ich][ilms].lms_prevvalues[recent] = av_clip(input, -range, range - 1);
@@ -990,8 +992,8 @@ static void revert_cdlms(WmallDecodeCtx *s, int tile_size)
}
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);
+ channel_coeff += pred;
}
if (s->transient[ich]) {
--s->channel[ich].transient_counter;
OpenPOWER on IntegriCloud