summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc_utils.h
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-09-06 15:06:34 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-09-06 15:30:25 +0100
commit92aa3e7fb21a4b0764ac8a0348a5bf84badee216 (patch)
treeb3c5248c1bcaf4b10cbd8bdbacf896478fb0dab3 /libavcodec/aacenc_utils.h
parent34e85cb340675ac9b67b72a34cc785bbc8863660 (diff)
aacenc: copy PRNG from the decoder
Needed for the following PNS commits. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aacenc_utils.h')
-rw-r--r--libavcodec/aacenc_utils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
index 327fbad833..0ab15a3e5e 100644
--- a/libavcodec/aacenc_utils.h
+++ b/libavcodec/aacenc_utils.h
@@ -128,6 +128,15 @@ static inline int quant_array_idx(const float val, const float *arr, const int n
return index;
}
+/*
+ * linear congruential pseudorandom number generator, copied from the decoder
+ */
+static inline int lcg_random(unsigned previous_val)
+{
+ union { unsigned u; int s; } v = { previous_val * 1664525u + 1013904223 };
+ return v.s;
+}
+
#define ERROR_IF(cond, ...) \
if (cond) { \
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \