Commit 72d06d61 authored by mru's avatar mru

Replace log2f(10) with a constant

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21924 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 2e16172e
...@@ -128,7 +128,7 @@ float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy, ...@@ -128,7 +128,7 @@ float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy,
// ^g_c = ^gamma_gc * 100.05 (predicted dB + mean dB - dB of fixed vector) // ^g_c = ^gamma_gc * 100.05 (predicted dB + mean dB - dB of fixed vector)
// Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)). // Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)).
float val = fixed_gain_factor * float val = fixed_gain_factor *
exp2f(log2f(10.0) * 0.05 * exp2f(M_LOG2_10 * 0.05 *
(ff_dot_productf(pred_table, prediction_error, 4) + (ff_dot_productf(pred_table, prediction_error, 4) +
energy_mean)) / energy_mean)) /
sqrtf(fixed_mean_energy); sqrtf(fixed_mean_energy);
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
#ifndef M_LN10 #ifndef M_LN10
#define M_LN10 2.30258509299404568402 /* log_e 10 */ #define M_LN10 2.30258509299404568402 /* log_e 10 */
#endif #endif
#ifndef M_LOG2_10
#define M_LOG2_10 3.32192809488736218171 /* log_2 10 */
#endif
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */ #define M_PI 3.14159265358979323846 /* pi */
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment