OSDN Git Service

Implement lms_predict()
authorMashiat Sarker Shakkhar <shahriman_ams@yahoo.com>
Sat, 5 Nov 2011 21:02:11 +0000 (03:02 +0600)
committerMashiat Sarker Shakkhar <shahriman_ams@yahoo.com>
Sun, 20 Nov 2011 08:51:39 +0000 (14:51 +0600)
libavcodec/wmalosslessdec.c

index 5c6eed1..eafe145 100644 (file)
@@ -754,6 +754,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