summaryrefslogtreecommitdiffstats
path: root/libavcodec/aaccoder.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-12-14 18:53:09 +0000
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-12-14 18:53:09 +0000
commitade31b9424f6bb8f70f277b1acb4575d312ed955 (patch)
treedfbf76b662cccb5001b39c0c2e27379852e11cdb /libavcodec/aaccoder.c
parent932cbc846f5574ed6b775a0fd586e70b5c8f84a2 (diff)
downloadffmpeg-streaming-ade31b9424f6bb8f70f277b1acb4575d312ed955.zip
ffmpeg-streaming-ade31b9424f6bb8f70f277b1acb4575d312ed955.tar.gz
aacenc: switch to using the RNG from libavutil
PSNR doesn't change as expected. The AAC spec doesn't really say anything about how exactly to generate noise. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aaccoder.c')
-rw-r--r--libavcodec/aaccoder.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 7e55494..15d467b 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -693,8 +693,12 @@ 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++)
- PNS[i] = s->random_state = lcg_random(s->random_state);
+ 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];
+ }
band_energy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]);
scale = noise_amp/sqrtf(band_energy);
s->fdsp->vector_fmul_scalar(PNS, PNS, scale, sce->ics.swb_sizes[g]);
OpenPOWER on IntegriCloud