diff options
author | Mashiat Sarker Shakkhar <shahriman_ams@yahoo.com> | 2011-11-06 03:02:11 +0600 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-11 03:26:42 +0100 |
commit | afd930dca23adad09ffbf6f9ff35b7258047895a (patch) | |
tree | 9324765a0deda33e9d5ec4d7e910837ac32c6cc1 /libavcodec/wmalosslessdec.c | |
parent | f12f189638ecd24cc004f46cf80e0a4d2b88c85b (diff) | |
download | ffmpeg-afd930dca23adad09ffbf6f9ff35b7258047895a.tar.gz |
Implement lms_predict()
(cherry picked from commit 83e31db195b9d0a07b0526eab5780817d8ce9444)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/wmalosslessdec.c')
-rw-r--r-- | libavcodec/wmalosslessdec.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index a60f477089..8f7f290548 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -757,6 +757,23 @@ static void reset_codec(WmallDecodeCtx *s) +static int lms_predict(WmallDecodeCtx *s, int ich, int ilms) +{ + int32_t pred, icoef; + int recent = s->cdlms[ich][ilms].recent; + + for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) + pred += s->cdlms[ich][ilms].coefs[icoef] * + s->cdlms[ich][ilms].lms_prevvalues[icoef + recent]; + + pred += (1 << (s->cdlms[ich][ilms].scaling - 1)); + /* XXX: Table 29 has: + iPred >= cdlms[iCh][ilms].scaling; + seems to me like a missing > */ + pred >>= s->cdlms[ich][ilms].scaling; + return pred; +} + /** *@brief Decode a single subframe (block). *@param s codec context |