summaryrefslogtreecommitdiff
path: root/libavcodec/g722.h
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-10-22 17:49:50 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-23 11:42:34 -0400
commit704721bc9cb47c58ce3dff8ef64ce3fb85283069 (patch)
treed6d363c20179f4f0127199706d27d283dc430c12 /libavcodec/g722.h
parentb95fbba705f2ed692a02b398b58aaf927a7acc91 (diff)
g722: split decoder and encoder into separate files
Diffstat (limited to 'libavcodec/g722.h')
-rw-r--r--libavcodec/g722.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/libavcodec/g722.h b/libavcodec/g722.h
new file mode 100644
index 0000000000..5edb6c8119
--- /dev/null
+++ b/libavcodec/g722.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) CMU 1993 Computer Science, Speech Group
+ * Chengxiang Lu and Alex Hauptmann
+ * Copyright (c) 2005 Steve Underwood <steveu at coppice.org>
+ * Copyright (c) 2009 Kenan Gillet
+ * Copyright (c) 2010 Martin Storsjo
+ *
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_G722_H
+#define AVCODEC_G722_H
+
+#include <stdint.h>
+
+#define PREV_SAMPLES_BUF_SIZE 1024
+
+typedef struct {
+ int16_t prev_samples[PREV_SAMPLES_BUF_SIZE]; ///< memory of past decoded samples
+ int prev_samples_pos; ///< the number of values in prev_samples
+
+ /**
+ * The band[0] and band[1] correspond respectively to the lower band and higher band.
+ */
+ struct G722Band {
+ int16_t s_predictor; ///< predictor output value
+ int32_t s_zero; ///< previous output signal from zero predictor
+ int8_t part_reconst_mem[2]; ///< signs of previous partially reconstructed signals
+ int16_t prev_qtzd_reconst; ///< previous quantized reconstructed signal (internal value, using low_inv_quant4)
+ int16_t pole_mem[2]; ///< second-order pole section coefficient buffer
+ int32_t diff_mem[6]; ///< quantizer difference signal memory
+ int16_t zero_mem[6]; ///< Seventh-order zero section coefficient buffer
+ int16_t log_factor; ///< delayed 2-logarithmic quantizer factor
+ int16_t scale_factor; ///< delayed quantizer scale factor
+ } band[2];
+
+ struct TrellisNode {
+ struct G722Band state;
+ uint32_t ssd;
+ int path;
+ } *node_buf[2], **nodep_buf[2];
+
+ struct TrellisPath {
+ int value;
+ int prev;
+ } *paths[2];
+} G722Context;
+
+extern const int16_t ff_g722_high_inv_quant[4];
+extern const int16_t ff_g722_low_inv_quant4[16];
+extern const int16_t ff_g722_low_inv_quant6[64];
+
+void ff_g722_update_low_predictor(struct G722Band *band, const int ilow);
+
+void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh,
+ const int ihigh);
+
+void ff_g722_apply_qmf(const int16_t *prev_samples, int *xout1, int *xout2);
+
+#endif /* AVCODEC_G722_H */