[FFmpeg-soc] [soc]: r4945 - amr/amrnbdec.c
cmcq
subversion at mplayerhq.hu
Wed Aug 5 14:50:55 CEST 2009
Author: cmcq
Date: Wed Aug 5 14:50:55 2009
New Revision: 4945
Log:
sqrt is faster than log by about five times (or 2.5 times with libimf)
test program:
#include <stdio.h>
#include <math.h>
#include <float.h>
int main(int argc, char *argv[])
{
float x;
float y = 0;
if (argc == 1) {
for (x = 1; x < 10; x += 0.0000005)
y += log10f(x);
printf("Total log: %f\n", y);
} else {
for (x = 1; x < 8; x += 0.0000005)
y += sqrtf(x);
printf("Total sqrt: %f\n", y);
}
return 0;
}
$ time ./test 1; time ./test
Total sqrt: 30237319.627204
real 0m0.249s
user 0m0.248s
sys 0m0.000s
Total log: 11628338.000000
real 0m1.385s
user 0m1.372s
sys 0m0.008s
Modified:
amr/amrnbdec.c
Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c Wed Aug 5 14:32:43 2009 (r4944)
+++ amr/amrnbdec.c Wed Aug 5 14:50:55 2009 (r4945)
@@ -700,11 +700,11 @@ static float fixed_gain_prediction(float
energy_pred = ff_dot_productf(energy_pred_fac, prev_pred_error, 4);
- energy_fixed_mean = ff_energyf(fixed_vector, AMR_SUBFRAME_SIZE);
- energy_fixed_mean = 10.0 * log10f(energy_fixed_mean / AMR_SUBFRAME_SIZE);
+ energy_fixed_mean = sqrt(ff_energyf(fixed_vector, AMR_SUBFRAME_SIZE) /
+ AMR_SUBFRAME_SIZE);
- return powf(10.0, 0.05 * (energy_pred + energy_mean[mode] -
- energy_fixed_mean));
+ return powf(10.0, 0.05 * (energy_pred + energy_mean[mode])) /
+ energy_fixed_mean;
}
/**
More information about the FFmpeg-soc
mailing list