On 21.04.2015 02:20, Claudio Freire wrote:
> On Mon, Apr 20, 2015 at 9:13 PM, Michael Niedermayer <michae...@gmx.at> wrote:
>> On Mon, Apr 20, 2015 at 09:07:14PM -0300, Claudio Freire wrote:
>>> On Mon, Apr 20, 2015 at 8:59 PM, Claudio Freire <klaussfre...@gmail.com> 
>>> wrote:
>>>> On Mon, Apr 20, 2015 at 8:32 PM, Andreas Cadhalpun
>>>> <andreas.cadhal...@googlemail.com> wrote:
>>>>>>>> The long version:
>>>>>>>>
>>>>>>>> ath should approximate the shape of the absolute hearing threshold, so
>>>>>>>> yes, it's best if it really uses the minimum, since that will prevent
>>>>>>>> clipping of the ath curve and result in a more accurate threshold
>>>>>>>> computation.
>>>>>>>
>>>>>>> So you agree with my patch fixing minath?
>>>>>>> Or would you prefer a version with:
>>>>>>>     minath = ath(3410 - 0.733 * ATH_ADD, ATH_ADD)
>>>>>>
>>>>>> Well, that's not really closer to the minimum (a few tests with gnuplot 
>>>>>> say).
>>>>>
>>>>> Are you sure your plots were done correctly?
>>>>> Because I'm quite sure this is the correct first order approximation
>>>>> of the minimum.
>>>>>
>>>>> For ATH_ADD = 4 this gives 3407.068, which is quite close to Michael's 
>>>>> value
>>>>> (3407.080774800152).
>>>>
>>>> I checked the formula several times, but still, I could have made a 
>>>> mistake.
>>>
>>>
>>> This is what I did if you want to check it out (maybe you spot the mistake)
>>>
>>> gnuplot> ath(f,a) = _ath(f/1000.0, a)
>>> gnuplot> _ath(f,a) = 3.64 * f**(-0.8) - 6.8 * exp(-0.6 * (f-3.4) *
>>> (f-3.4)) + 6.0 * exp(-0.15 * (f-8.7) * (f-8.7)) + (0.6 + 0.04 * a) *
>>> 0.001 * f * f * f
>>           ^^^^^^^^^^
>> missing * f
> 
> Much better now :)
> 
> So yes. I'd say it's a good change.

OK, patch attached.

Best regards,
Andreas

>From c1ec8336f7de45b1919e3f76ee979c47a28ca33e Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Tue, 21 Apr 2015 18:43:55 +0200
Subject: [PATCH] aacpsy: correct calculation of minath in psy_3gpp_init

The minimum of the ath(x, ATH_ADD) function depends on ATH_ADD.
This patch uses the first order approximation to determine it.

For ATH_ADD = 4 this results in the value at 3407.06812 (-5.24241638)
not the one at 3410 (-5.24237967).

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavcodec/aacpsy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 7205ee3..49ff3fe 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -313,7 +313,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
     ctx->bitres.size   = 6144 - pctx->frame_bits;
     ctx->bitres.size  -= ctx->bitres.size % 8;
     pctx->fill_level   = ctx->bitres.size;
-    minath = ath(3410, ATH_ADD);
+    minath = ath(3410 - 0.733 * ATH_ADD, ATH_ADD);
     for (j = 0; j < 2; j++) {
         AacPsyCoeffs *coeffs = pctx->psy_coef[j];
         const uint8_t *band_sizes = ctx->bands[j];
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to