mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
aacenc: aac_psy_init(): Factorize line_to_frequency.
Originally committed as revision 24232 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d7194e3b73
commit
cecaf7d71a
@ -124,11 +124,12 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
|
|||||||
minath = ath(3410, ATH_ADD);
|
minath = ath(3410, ATH_ADD);
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
Psy3gppCoeffs *coeffs = &pctx->psy_coef[j];
|
Psy3gppCoeffs *coeffs = &pctx->psy_coef[j];
|
||||||
|
float line_to_frequency = ctx->avctx->sample_rate / 2048.0f;
|
||||||
i = 0;
|
i = 0;
|
||||||
prev = 0.0;
|
prev = 0.0;
|
||||||
for (g = 0; g < ctx->num_bands[j]; g++) {
|
for (g = 0; g < ctx->num_bands[j]; g++) {
|
||||||
i += ctx->bands[j][g];
|
i += ctx->bands[j][g];
|
||||||
bark = calc_bark((i-1) * ctx->avctx->sample_rate / 2048.0);
|
bark = calc_bark((i-1) * line_to_frequency);
|
||||||
coeffs->barks[g] = (bark + prev) / 2.0;
|
coeffs->barks[g] = (bark + prev) / 2.0;
|
||||||
prev = bark;
|
prev = bark;
|
||||||
}
|
}
|
||||||
@ -138,9 +139,9 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
|
|||||||
}
|
}
|
||||||
start = 0;
|
start = 0;
|
||||||
for (g = 0; g < ctx->num_bands[j]; g++) {
|
for (g = 0; g < ctx->num_bands[j]; g++) {
|
||||||
minscale = ath(ctx->avctx->sample_rate * start / 1024.0 / 2.0, ATH_ADD);
|
minscale = ath(start * line_to_frequency, ATH_ADD);
|
||||||
for (i = 1; i < ctx->bands[j][g]; i++)
|
for (i = 1; i < ctx->bands[j][g]; i++)
|
||||||
minscale = FFMIN(minscale, ath(ctx->avctx->sample_rate * (start + i) / 1024.0 / 2.0, ATH_ADD));
|
minscale = FFMIN(minscale, ath((start + i) * line_to_frequency, ATH_ADD));
|
||||||
coeffs->ath[g] = minscale - minath;
|
coeffs->ath[g] = minscale - minath;
|
||||||
start += ctx->bands[j][g];
|
start += ctx->bands[j][g];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user