Hi, in my profiling, ff_sbr_apply accounts for ~12% of the decoding time, but it has a lot of inlining. The divisions I modify seem to account for ~5% of that, so precomputing them is interesting. Disassembly shows a gcc 4.6.2 on x86 64 with -funsafe-math-optimizations does not do this, while the attached patch does remove 2 such divisions. Not sure what part of these explanations is interesting to put in the log message.
Christophe
From 8a506ad73e1951d71f401d22f195fffee894e4d7 Mon Sep 17 00:00:00 2001 From: Christophe Gisquet <[email protected]> Date: Tue, 28 Feb 2012 11:02:59 +0100 Subject: [PATCH 5/6] AAC SBR: precompute some inverse values. --- libavcodec/aacsbr.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 47e95f1..caca5f4 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -1234,6 +1234,7 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp, alpha1[k][1] = 0; } else { float temp_real, temp_im; + dk = 1.0f / dk; temp_real = phi[0][0][0] * phi[1][1][0] - phi[0][0][1] * phi[1][1][1] - phi[0][1][0] * phi[1][0][0]; @@ -1241,22 +1242,22 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp, phi[0][0][1] * phi[1][1][0] - phi[0][1][1] * phi[1][0][0]; - alpha1[k][0] = temp_real / dk; - alpha1[k][1] = temp_im / dk; + alpha1[k][0] = temp_real * dk; + alpha1[k][1] = temp_im * dk; } if (!phi[1][0][0]) { alpha0[k][0] = 0; alpha0[k][1] = 0; } else { - float temp_real, temp_im; + float temp_real, temp_im, fact = 1.0f / phi[1][0][0]; temp_real = phi[0][0][0] + alpha1[k][0] * phi[1][1][0] + alpha1[k][1] * phi[1][1][1]; temp_im = phi[0][0][1] + alpha1[k][1] * phi[1][1][0] - alpha1[k][0] * phi[1][1][1]; - alpha0[k][0] = -temp_real / phi[1][0][0]; - alpha0[k][1] = -temp_im / phi[1][0][0]; + alpha0[k][0] = -temp_real * fact; + alpha0[k][1] = -temp_im * fact; } if (alpha1[k][0] * alpha1[k][0] + alpha1[k][1] * alpha1[k][1] >= 16.0f || -- 1.7.7.6
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
