On 08/30/2010 02:31 PM, Vitor Sessak wrote:
On 08/27/2010 11:13 PM, Marcelo Galvão Póvoa wrote:
On 26 August 2010 18:55, Vitor Sessak<[email protected]>  wrote:
Marcelo Galvão Póvoa wrote:


[...]

+/**
+ * Apply to synthesis a 2nd order high-pass filter
+ *
+ * @param[out] out                 Buffer for filtered output
+ * @param[in] hpf_coef             Filter coefficients as used below
+ * @param[in,out] mem State from last filtering (updated)
+ * @param[in] in                   Input speech data
+ *
+ * @remark It is safe to pass the same array in in and out parameters
+ */
+static void high_pass_filter(float *out, const float hpf_coef[2][3],
+                             float mem[4], const float *in)
+{
+    int i;
+    float *x = mem - 1, *y = mem + 2; // previous inputs and outputs
+
+    for (i = 0; i<  AMRWB_SFR_SIZE; i++) {
+        float x0 = in[i];
+
+        out[i] = hpf_coef[0][0] * x0   + hpf_coef[1][0] * y[0] +
+                 hpf_coef[0][1] * x[1] + hpf_coef[1][1] * y[1] +
+                 hpf_coef[0][2] * x[2];
+
+        y[1] = y[0];
+        y[0] = out[i];
+
+        x[2] = x[1];
+        x[1] = x0;
+    }
+}
acelp_filter.c:ff_acelp_apply_order_2_transfer_function()

Are you sure? I can't see them as equivalent, could you explain?

I'll give a better look at it soon...

Try the attached patch, it practically does not change the output:

deus-23k85.awbstddev: 0.08 PSNR:118.01 MAXDIFF: 1 bytes: 1054720/ 1054720 seed-12k65.awbstddev: 0.06 PSNR:119.94 MAXDIFF: 1 bytes: 327680/ 327680 seed-14k25.awbstddev: 0.06 PSNR:119.59 MAXDIFF: 1 bytes: 327680/ 327680 seed-15k85.awbstddev: 0.06 PSNR:119.92 MAXDIFF: 1 bytes: 327680/ 327680 seed-18k25.awbstddev: 0.07 PSNR:119.32 MAXDIFF: 1 bytes: 327680/ 327680 seed-19k85.awbstddev: 0.07 PSNR:119.20 MAXDIFF: 1 bytes: 327680/ 327680 seed-23k05.awbstddev: 0.07 PSNR:119.35 MAXDIFF: 1 bytes: 327680/ 327680 seed-23k85.awbstddev: 0.07 PSNR:119.42 MAXDIFF: 1 bytes: 327680/ 327680 seed-6k60.awbstddev: 0.06 PSNR:119.61 MAXDIFF: 1 bytes: 327680/ 327680 seed-8k85.awbstddev: 0.07 PSNR:119.19 MAXDIFF: 1 bytes: 327680/ 327680

-Vitor
--- b/libavcodec/amrwbdec.c	2010-09-02 23:37:50.459290512 +0200
+++ libavcodec/amrwbdec.c	2010-09-03 10:13:39.492299598 +0200
@@ -1274,15 +1274,21 @@
         de_emphasis(&ctx->samples_up[UPS_MEM_SIZE],
                     &ctx->samples_az[LP_ORDER], PREEMPH_FAC, ctx->demph_mem);
 
-        high_pass_filter(&ctx->samples_up[UPS_MEM_SIZE], hpf_31_coef,
-                         ctx->hpf_31_mem, &ctx->samples_up[UPS_MEM_SIZE]);
+        ff_acelp_apply_order_2_transfer_function(&ctx->samples_up[UPS_MEM_SIZE],
+            &ctx->samples_up[UPS_MEM_SIZE],
+            (const float[2]) { -2.0,      1.0 },
+            (const float[2]) { -1.978881836, 0.979125977 },
+            0.989501953, ctx->hpf_31_mem, AMRWB_SFR_SIZE);
 
         upsample_5_4(sub_buf, &ctx->samples_up[UPS_FIR_SIZE],
                      AMRWB_SFR_SIZE_16k);
 
         /* High frequency band (6.4 - 7.0 kHz) generation part */
-        high_pass_filter(hb_samples, hpf_400_coef, ctx->hpf_400_mem,
-                         &ctx->samples_up[UPS_MEM_SIZE]);
+        ff_acelp_apply_order_2_transfer_function(hb_samples,
+            &ctx->samples_up[UPS_MEM_SIZE],
+            (const float[2]) { -2.0,      1.0 },
+            (const float[2]) { -1.787109375, 0.864257812 },
+            0.893554687, ctx->hpf_400_mem, AMRWB_SFR_SIZE);
 
         hb_gain = find_hb_gain(ctx, hb_samples,
                                cur_subframe->hb_gain, cf->vad);
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to