From 84f4be424d52b05fabe0fe8cfb569c77fc0c1f7b Mon Sep 17 00:00:00 2001 From: Claudio Freire Date: Sun, 1 Mar 2015 20:11:12 -0300 Subject: [PATCH] avcodec/aacpsy: Fix AAC Psy PE reduction calculation when multiple iterations are required This is a small change, but it does have a big impact on bit allocation. all the regressions marked in the report have no audible difference (I didn't check them all though), but the improvements can be heard. This affects mostly high bit rates. It's related to issue #2686. In the report, A is the patched version, B is unpatched, all comparisons show deltas in the form (A-B), so a positive pSNR delta means a better quality in the patched version, and negative a regression. Regressions are only considered for pSNR deltas below -1db, they're considered serious below -6db. All measurements were done with tiny_psnr. The summary of the report inline for quick reading: Files: 58 Bitrates: 6 Tests: 347 Serious Regressions: 0 (0%) Regressions: 10 (2%) Improvements: 54 (15%) Big improvements: 26 (7%) Worst regression - sine_tester.flac - 384k - StdDev: 1.68 pSNR: -3.05 maxdiff: -178.00 Best improvement - 07 - Bound.flac - 384k - StdDev: -1700.05 pSNR: 20.64 maxdiff: -29595.00 Average - StdDev: -55.67 pSNR: 1.20 maxdiff: -1593.00 Signed-off-by: Michael Niedermayer --- libavcodec/aacpsy.c | 2 +- tests/fate/aac.mak | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index 068fbcd8d0..d1e65f6607 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -717,7 +717,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel, } desired_pe_no_ah = FFMAX(desired_pe - (pe - pe_no_ah), 0.0f); if (active_lines > 0.0f) - reduction += calc_reduction_3gpp(a, desired_pe_no_ah, pe_no_ah, active_lines); + reduction = calc_reduction_3gpp(a, desired_pe_no_ah, pe_no_ah, active_lines); pe = 0.0f; for (w = 0; w < wi->num_windows*16; w += 16) { diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak index b36c861f36..97e5d2719a 100644 --- a/tests/fate/aac.mak +++ b/tests/fate/aac.mak @@ -91,7 +91,7 @@ fate-aac-aref-encode: CMD = enc_dec_pcm adts wav s16le $(REF) -strict -2 -c:a aa fate-aac-aref-encode: CMP = stddev fate-aac-aref-encode: REF = ./tests/data/asynth-44100-2.wav fate-aac-aref-encode: CMP_SHIFT = -4096 -fate-aac-aref-encode: CMP_TARGET = 1862 +fate-aac-aref-encode: CMP_TARGET = 438 fate-aac-aref-encode: SIZE_TOLERANCE = 2464 FATE_AAC_ENCODE += fate-aac-ln-encode -- GitLab