mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
aacenc: reduce the number of loop index variables
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
This commit is contained in:
parent
333e894363
commit
57cc1ad35f
@ -110,7 +110,7 @@ static av_always_inline float quantize_and_encode_band_cost_template(
|
|||||||
const float IQ = ff_aac_pow2sf_tab[200 + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
|
const float IQ = ff_aac_pow2sf_tab[200 + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
|
||||||
const float Q = ff_aac_pow2sf_tab[200 - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
|
const float Q = ff_aac_pow2sf_tab[200 - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
|
||||||
const float CLIPPED_ESCAPE = 165140.0f*IQ;
|
const float CLIPPED_ESCAPE = 165140.0f*IQ;
|
||||||
int i, j, k;
|
int i, j;
|
||||||
float cost = 0;
|
float cost = 0;
|
||||||
const int dim = BT_PAIR ? 2 : 4;
|
const int dim = BT_PAIR ? 2 : 4;
|
||||||
int resbits = 0;
|
int resbits = 0;
|
||||||
@ -149,10 +149,10 @@ static av_always_inline float quantize_and_encode_band_cost_template(
|
|||||||
curbits = ff_aac_spectral_bits[cb-1][curidx];
|
curbits = ff_aac_spectral_bits[cb-1][curidx];
|
||||||
vec = &ff_aac_codebook_vectors[cb-1][curidx*dim];
|
vec = &ff_aac_codebook_vectors[cb-1][curidx*dim];
|
||||||
if (BT_UNSIGNED) {
|
if (BT_UNSIGNED) {
|
||||||
for (k = 0; k < dim; k++) {
|
for (j = 0; j < dim; j++) {
|
||||||
float t = fabsf(in[i+k]);
|
float t = fabsf(in[i+j]);
|
||||||
float di;
|
float di;
|
||||||
if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow
|
if (BT_ESC && vec[j] == 64.0f) { //FIXME: slow
|
||||||
if (t >= CLIPPED_ESCAPE) {
|
if (t >= CLIPPED_ESCAPE) {
|
||||||
di = t - CLIPPED_ESCAPE;
|
di = t - CLIPPED_ESCAPE;
|
||||||
curbits += 21;
|
curbits += 21;
|
||||||
@ -162,15 +162,15 @@ static av_always_inline float quantize_and_encode_band_cost_template(
|
|||||||
curbits += av_log2(c)*2 - 4 + 1;
|
curbits += av_log2(c)*2 - 4 + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
di = t - vec[k]*IQ;
|
di = t - vec[j]*IQ;
|
||||||
}
|
}
|
||||||
if (vec[k] != 0.0f)
|
if (vec[j] != 0.0f)
|
||||||
curbits++;
|
curbits++;
|
||||||
rd += di*di;
|
rd += di*di;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (k = 0; k < dim; k++) {
|
for (j = 0; j < dim; j++) {
|
||||||
float di = in[i+k] - vec[k]*IQ;
|
float di = in[i+j] - vec[j]*IQ;
|
||||||
rd += di*di;
|
rd += di*di;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user