Needed for the following PNS commits.
Unified · Split
| @@ -861,6 +861,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 860 unmodified lines | ||
| 861 | 861 | ff_aac_coder_init_mips(s); |
| 862 | 862 | |
| 863 | 863 | s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120; |
| 864 | + s->random_state = 0x1f2e3d4c; | |
| 864 | 865 | |
| 865 | 866 | ff_aac_tableinit(); |
| 866 | 867 | |
| @@ -98,6 +98,7 @@ typedef struct AACEncContext { · 97 unmodified lines | ||
| 98 | 98 | AACCoefficientsEncoder *coder; |
| 99 | 99 | int cur_channel; |
| 100 | 100 | int last_frame; |
| 101 | + int random_state; | |
| 101 | 102 | float lambda; |
| 102 | 103 | AudioFrameQueue afq; |
| 103 | 104 | DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients |
| @@ -128,6 +128,15 @@ static inline int quant_array_idx(const float val, const float *arr, const int n · 127 unmodified lines | ||
| 128 | 128 | return index; |
| 129 | 129 | } |
| 130 | 130 | |
| 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 | + | |
| 131 | 140 | #define ERROR_IF(cond, ...) \ |
| 132 | 141 | if (cond) { \ |
| 133 | 142 | av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \ |