aacenc: copy PRNG from the decoder
Needed for the following PNS commits. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
parent
34e85cb340
commit
92aa3e7fb2
@ -861,6 +861,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
|||||||
ff_aac_coder_init_mips(s);
|
ff_aac_coder_init_mips(s);
|
||||||
|
|
||||||
s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;
|
s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;
|
||||||
|
s->random_state = 0x1f2e3d4c;
|
||||||
|
|
||||||
ff_aac_tableinit();
|
ff_aac_tableinit();
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ typedef struct AACEncContext {
|
|||||||
AACCoefficientsEncoder *coder;
|
AACCoefficientsEncoder *coder;
|
||||||
int cur_channel;
|
int cur_channel;
|
||||||
int last_frame;
|
int last_frame;
|
||||||
|
int random_state;
|
||||||
float lambda;
|
float lambda;
|
||||||
AudioFrameQueue afq;
|
AudioFrameQueue afq;
|
||||||
DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients
|
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
|
|||||||
return index;
|
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, ...) \
|
#define ERROR_IF(cond, ...) \
|
||||||
if (cond) { \
|
if (cond) { \
|
||||||
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
|
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user