[FFmpeg-soc] [PATCH] AMR-WB Decoder
Vitor Sessak
vitor1001 at gmail.com
Sat Sep 4 11:02:32 CEST 2010
On 09/03/2010 11:50 PM, Marcelo Galvão Póvoa wrote:
> On 3 September 2010 05:19, Vitor Sessak<vitor1001 at gmail.com> wrote:
>
>> 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<vitor1001 at gmail.com> 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
>>
>>
> I've tried testing with two other samples I encoded and the results were:
> all_man.awb stddev: 0.24 PSNR:108.64 MAXDIFF: 1 bytes: 473600/ 473600
> conference-23k85.awb stddev: 0.20 PSNR:109.95 MAXDIFF: 1 bytes:
> 157440/ 157440
>
> I think I should apply this patch then?
>
Yes, 0.24 is a very small difference.
> I noticed that when I run the comparison for deus-23k85.awb the stddev
> is 0.16, not 0.08 like yours. Maybe it's because I am on OS X or I did
> something wrong?
>
It happens. Floating point output might vary depending if on your CPU
and your compiler.
> Also, whether with this patch or not I guess my output to the first
> sample above (attached) is not good compared to the reference decoder.
> The are some sharp peaks that can be seen with Audacity, one of them
> also with clipping. The stddev I've got seems ugly:
> stddev: 884.86 PSNR: 37.39 MAXDIFF:23298 bytes: 473600/ 473600
>
Indeed, the stddev is not particularly good, but don't trust only it to
do comparisons. A very small phase shift can completely ruin the stddev.
Do you see sharp peaks in your output that are not there in the
reference decoder? Or the sharp peaks shows up when you invert and
superpose the waves? Do these sharp peaks gives audible artifacts?
> Inverting one of the waves and playing them simultaneously I can hear
> some intermittent artifacts, so I guess there is still something wrong
> with the decoder.
>
This is also something that is very sensible to a tiny phase difference...
-Vitor
More information about the FFmpeg-soc
mailing list