[FFmpeg-devel] [PATCH 2/2] Add SIPR decoder for 5k0, 6k5 and 8k5 modes

Ronald S. Bultje rsbultje
Mon Jan 11 19:11:12 CET 2010


Hi,

On Sun, Jan 10, 2010 at 4:43 PM, Vitor Sessak <vitor1001 at gmail.com> wrote:
> Now the patch that adds 16k support. I'm undecided if I should put this code
> in a separated file...

Index: libavcodec/siprdata.h
[..]
+static const float gain_cb_16k[32] =
+{
+    0.07499,     0.10593,     0.14125,     0.18836,

Lots of spaces?

[..]

Index: libavcodec/sipr.c
[..]
+    int ma_pred_switch;        ///< switched MA predictor

What's MA?

+/**
+ * Convert an lsf vector into an lsp vector.
+ *
+ * @param lsf               input lsf vector
+ * @param lsp               output lsp vector
+ */
+static void lsf2lsp(float *lsf, double *lsp)
+{
+    int i;

-static void dequant(float *out, const int *idx, const float *cbs[])
+    for (i = 0; i < LP_FILTER_ORDER_16k; i++)
+        lsp[i] = cos(lsf[i]);
+}
+
+static void dequant(float *out, const int *idx, const float *cbs[],
+                    int mode_16k)

I wish we could teach diff how silly this looks. Just look.

You can mark lsf as const, maybe makes it a bit faster, since it's not
changed in the function. the same could probably be done elsewhere
also (not critical...).

[..]
+    for (i = 0; i < LP_FILTER_ORDER_16k; i++)
+        ctx->lsp_history_16k[i] = cos((i+1) * M_PI /
(LP_FILTER_ORDER_16k + 1));

if (mode == 16k)?

I'll do the actual decode / postfilter functions later, I have some
other stuff to do first... :-(.

Ronald



More information about the ffmpeg-devel mailing list