[FFmpeg-devel] [PATCH] Add AMR-NB decoder, next try

Ronald S. Bultje rsbultje
Wed Jan 27 23:38:23 CET 2010


Hi,

On Sun, Jan 24, 2010 at 7:02 PM, Vitor Sessak <vitor1001 at gmail.com> wrote:
> New patch attached, thanks Collin for the changes.

+/// @defgroup amr_lpc_decoding AMR pitch LPC coefficient decoding functions

I love this style of group-documenting. We should do it everywhere.

+static void lsf2lsp(const float *lsf, double *lsp)
+{
+    int i;
+
+    for (i = 0; i < LP_FILTER_ORDER; i++)
+        lsp[i] = cos(2.0 * M_PI / 8000.0 * lsf[i]);
+}
+
+/**
+ * Interpolate the LSF vector (used for fixed gain smoothing).
+ * The interpolation is done over all four subframes even in MODE_12k2.
+ *
+ * @param[in,out] lsf_q     LSFs in [0,1] for each subframe
+ * @param[in]     lsf_new   New LSFs in Hertz for subframe 4
+ */
+static void interpolate_lsf(float lsf_q[4][LP_FILTER_ORDER], float *lsf_new)
+{
+    int i;
+
+    for (i = 0; i < 4; i++)
+        ff_weighted_vector_sumf(lsf_q[i], lsf_q[3], lsf_new,
+                                0.25 * (3 - i), 0.25 / 8000.0 * (i + 1),
+                                LP_FILTER_ORDER);
+}

Can all LSFs be kept in the [0,1] range (so also lsf_new) as soon as
they're converted to float?

+static void lsf2lsp_3(AMRContext *p)
[..]
+    for (i = 0; i < 3; i++)
+        weighted_vector_sumd(p->lsp[i], p->prev_lsp_sub4, p->lsp[3],
+                                0.25 * (3 - i), 0.25 * (i + 1),
+                                LP_FILTER_ORDER);

Is for i=1;i<=3.. and then using the same code as in sipr (so not
calling weighted_vector_sum*(), but simply prev[] +
i*0.25*(cur[]-prev[])) faster? Same for above if you can get them in
the same scale.

+ * In the patent description "Method and device for coding speech in
+ * analysis-by-synthesis speech coders" by Ari P. Heikkinen, this method
+ * is called "adaptive phase dispersion". This name is also used in the
+ * reference source, but not in the spec.

You sure you want to explicitly mention patents in a source code? :-).

Ronald



More information about the ffmpeg-devel mailing list