Commit 4819d43d authored by Michael Niedermayer's avatar Michael Niedermayer

aacpsy: use exp2(f) instead of pow(f)(2,...)

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b027156b
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
* AAC encoder psychoacoustic model * AAC encoder psychoacoustic model
*/ */
#include "libavutil/libm.h"
#include "avcodec.h" #include "avcodec.h"
#include "aactab.h" #include "aactab.h"
#include "psymodel.h" #include "psymodel.h"
...@@ -333,7 +335,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { ...@@ -333,7 +335,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
coeff->spread_low[1] = pow(10.0, -bark_width * en_spread_low); coeff->spread_low[1] = pow(10.0, -bark_width * en_spread_low);
coeff->spread_hi [1] = pow(10.0, -bark_width * en_spread_hi); coeff->spread_hi [1] = pow(10.0, -bark_width * en_spread_hi);
pe_min = bark_pe * bark_width; pe_min = bark_pe * bark_width;
minsnr = pow(2.0f, pe_min / band_sizes[g]) - 1.5f; minsnr = exp2(pe_min / band_sizes[g]) - 1.5f;
coeff->min_snr = av_clipf(1.0f / minsnr, PSY_SNR_25DB, PSY_SNR_1DB); coeff->min_snr = av_clipf(1.0f / minsnr, PSY_SNR_25DB, PSY_SNR_1DB);
} }
start = 0; start = 0;
...@@ -524,8 +526,8 @@ static float calc_reduction_3gpp(float a, float desired_pe, float pe, ...@@ -524,8 +526,8 @@ static float calc_reduction_3gpp(float a, float desired_pe, float pe,
{ {
float thr_avg, reduction; float thr_avg, reduction;
thr_avg = powf(2.0f, (a - pe) / (4.0f * active_lines)); thr_avg = exp2f((a - pe) / (4.0f * active_lines));
reduction = powf(2.0f, (a - desired_pe) / (4.0f * active_lines)) - thr_avg; reduction = exp2f((a - desired_pe) / (4.0f * active_lines)) - thr_avg;
return FFMAX(reduction, 0.0f); return FFMAX(reduction, 0.0f);
} }
...@@ -703,7 +705,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel, ...@@ -703,7 +705,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
float delta_sfb_pe = band->norm_fac * norm_fac * delta_pe; float delta_sfb_pe = band->norm_fac * norm_fac * delta_pe;
float thr = band->thr; float thr = band->thr;
thr *= powf(2.0f, delta_sfb_pe / band->active_lines); thr *= exp2f(delta_sfb_pe / band->active_lines);
if (thr > coeffs[g].min_snr * band->energy && band->avoid_holes == PSY_3GPP_AH_INACTIVE) if (thr > coeffs[g].min_snr * band->energy && band->avoid_holes == PSY_3GPP_AH_INACTIVE)
thr = FFMAX(band->thr, coeffs[g].min_snr * band->energy); thr = FFMAX(band->thr, coeffs[g].min_snr * band->energy);
band->thr = thr; band->thr = thr;
......
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