Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclsid2 <clsid2@users.sourceforge.net>2010-04-19 23:29:00 +0400
committerclsid2 <clsid2@users.sourceforge.net>2010-04-19 23:29:00 +0400
commite220e2c9e47b5c1f98eec2c8deead4074fa07c76 (patch)
treecf616685c536ce5089d76c46dfe3df14b17a3924 /src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/lpc.h
parent0b7b1d06b32b43517f7b584207533ecfe5ce20fa (diff)
Updated FFmpeg
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1792 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/lpc.h')
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/lpc.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/lpc.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/lpc.h
new file mode 100644
index 000000000..c8053d0d7
--- /dev/null
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/lpc.h
@@ -0,0 +1,81 @@
+/**
+ * LPC utility code
+ * Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_LPC_H
+#define AVCODEC_LPC_H
+
+#include <stdint.h>
+
+#ifdef LPC_USE_DOUBLE
+#define LPC_TYPE double
+#else
+#define LPC_TYPE float
+#endif
+
+/**
+ * Levinson-Durbin recursion.
+ * Produces LPC coefficients from autocorrelation data.
+ */
+static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
+ LPC_TYPE *lpc, int lpc_stride, int fail,
+ int normalize)
+{
+ int i, j;
+ LPC_TYPE err;
+ LPC_TYPE *lpc_last = lpc;
+
+ if (normalize)
+ err = *autoc++;
+
+ if (fail && (autoc[max_order - 1] == 0 || err <= 0))
+ return -1;
+
+ for(i=0; i<max_order; i++) {
+ LPC_TYPE r = -autoc[i];
+
+ if (normalize) {
+ for(j=0; j<i; j++)
+ r -= lpc_last[j] * autoc[i-j-1];
+
+ r /= err;
+ err *= 1.0 - (r * r);
+ }
+
+ lpc[i] = r;
+
+ for(j=0; j < (i+1)>>1; j++) {
+ LPC_TYPE f = lpc_last[ j];
+ LPC_TYPE b = lpc_last[i-1-j];
+ lpc[ j] = f + r * b;
+ lpc[i-1-j] = b + r * f;
+ }
+
+ if (fail && err < 0)
+ return -1;
+
+ lpc_last = lpc;
+ lpc += lpc_stride;
+ }
+
+ return 0;
+}
+
+#endif /* AVCODEC_LPC_H */