mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-02-04 14:30:55 +08:00
aacenc: use the decoder's lcg PRNG
Using lfg was an overkill in this case where the random numbers were only used for encoder descisions. Should increase result uniformity between different FPUs and gives a slight speedup. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
@@ -643,11 +643,9 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
|
||||
float band_energy, scale, pns_senergy;
|
||||
const int start_c = (w+w2)*128+sce->ics.swb_offset[g];
|
||||
band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
|
||||
for (i = 0; i < sce->ics.swb_sizes[g]; i+=2) {
|
||||
double rnd[2];
|
||||
av_bmg_get(&s->lfg, rnd);
|
||||
PNS[i+0] = (float)rnd[0];
|
||||
PNS[i+1] = (float)rnd[1];
|
||||
for (i = 0; i < sce->ics.swb_sizes[g]; i++) {
|
||||
s->random_state = lcg_random(s->random_state);
|
||||
PNS[i] = s->random_state;
|
||||
}
|
||||
band_energy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]);
|
||||
scale = noise_amp/sqrtf(band_energy);
|
||||
|
||||
Reference in New Issue
Block a user