History

aacenc: copy PRNG from the decoder

Needed for the following PNS commits.

Rostislav Pehlivanov committed 11 years ago

Commit 92aa3e71 parent 34e85cb3 files · +11 −0Browse files

Unified · Split

3 files
  1. libavcodec/aacenc.c +1 −0
  2. libavcodec/aacenc.h +1 −0
  3. libavcodec/aacenc_utils.h +9 −0
libavcodec/aacenc.c+1−0
@@ -861,6 +861,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 860 unmodified lines
861861 ff_aac_coder_init_mips(s);
862862
863863 s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;
864+ s->random_state = 0x1f2e3d4c;
864865
865866 ff_aac_tableinit();
866867
libavcodec/aacenc.h+1−0
@@ -98,6 +98,7 @@ typedef struct AACEncContext { · 97 unmodified lines
9898 AACCoefficientsEncoder *coder;
9999 int cur_channel;
100100 int last_frame;
101+ int random_state;
101102 float lambda;
102103 AudioFrameQueue afq;
103104 DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients
libavcodec/aacenc_utils.h+9−0
@@ -128,6 +128,15 @@ static inline int quant_array_idx(const float val, const float *arr, const int n · 127 unmodified lines
128128 return index;
129129 }
130130
131+/*
132+ * linear congruential pseudorandom number generator, copied from the decoder
133+ */
134+static inline int lcg_random(unsigned previous_val)
135+{
136+ union { unsigned u; int s; } v = { previous_val * 1664525u + 1013904223 };
137+ return v.s;
138+}
139+
131140 #define ERROR_IF(cond, ...) \
132141 if (cond) { \
133142 av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t