[FFmpeg-devel] [PATCH] RealAudio SIPR @16k decoder (1/4) Core

Zuxy Meng zuxy.meng
Sun Jul 13 08:21:36 CEST 2008


Hi,

2008/7/12 Vladimir Voroshilov <voroshil at gmail.com>:
> Hi, All
>
> Here is first draft version of fixed-point RealAudio sipr decoder
> (only 16kHz mode)
>
> This patch contains core routine.
>

+static void init_decod_16k(Sipr_Context * ctx)
+{
+    int i;
+
+    ctx->len_frame = 2 * L_SUBFR_16k0;
+
+    ctx->past_qua_en[0] = -14;
+    ctx->past_qua_en[1] = -14;
+
+    ctx->exc = ctx->old_exc + L_INTERPOL + PITCH_MAX;
+
+    ctx->B_past[0] = ctx->A_past[0] = 4096;
+
+    for(i=0; i<LP_FILTER_ORDER; i++)
+    {
+        ctx->past_lsf_q[i] = (i+1) * LSFQ_MAX / (LP_FILTER_ORDER + 1);
+        ctx->past_lsf[i] = ff_cos(ctx->past_lsf_q[i]);
+    }
+
+}
+static int ff_sipr_decoder_init(AVCodecContext * avctx)
+{
+    Sipr_Context *ctx = avctx->priv_data;
+
+    if(avctx->block_align != 20) {
+        av_log(avctx,AV_LOG_ERROR,"Invalid framesize detected: %d\n",
avctx->block_align);
+        return -1;
+    }
+
+    ctx->bits_per_frame = 160;
+
+    init_decod_16k(ctx);
+
+    return 0;
+}

You may apply "av_cold" to these two functions.

-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6




More information about the ffmpeg-devel mailing list