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
861 ff_aac_coder_init_mips(s);861 ff_aac_coder_init_mips(s);
862 862
863 s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;863 s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;
864 s->random_state = 0x1f2e3d4c;
864 865
865 ff_aac_tableinit();866 ff_aac_tableinit();
866 867
libavcodec/aacenc.h+1−0
@@ -98,6 +98,7 @@ typedef struct AACEncContext { · 97 unmodified lines
98 AACCoefficientsEncoder *coder;98 AACCoefficientsEncoder *coder;
99 int cur_channel;99 int cur_channel;
100 int last_frame;100 int last_frame;
101 int random_state;
101 float lambda;102 float lambda;
102 AudioFrameQueue afq;103 AudioFrameQueue afq;
103 DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients104 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
128 return index;128 return index;
129}129}
130 130
131/*
132 * linear congruential pseudorandom number generator, copied from the decoder
133 */
134static 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
131#define ERROR_IF(cond, ...) \140#define ERROR_IF(cond, ...) \
132 if (cond) { \141 if (cond) { \
133 av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \142 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