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 | 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 | ||
| @@ -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 coefficients | 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 | return index; | 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 | #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__); \ |