dnxhd_get_blocks(ctx, mb_x, mb_y);
for (i = 0; i < 8; i++) {
- DECLARE_ALIGNED_16(DCTELEM, block[64]);
+ DECLARE_ALIGNED_16(DCTELEM, block)[64];
DCTELEM *src_block = ctx->blocks[i];
int overflow, nbits, diff, last_index;
int n = dnxhd_switch_matrix(ctx, i);
last_higher = FFMAX(lambda, last_higher);
if (last_lower != INT_MAX)
lambda = (lambda+last_lower)>>1;
+ else if ((int64_t)lambda + up_step > INT_MAX)
+ return -1;
else
lambda += up_step;
- up_step *= 5;
+ up_step = FFMIN((int64_t)up_step*5, INT_MAX);
down_step = 1<<LAMBDA_FRAC_BITS;
}
}
else
ret = dnxhd_encode_fast(avctx, ctx);
if (ret < 0) {
- av_log(avctx, AV_LOG_ERROR, "picture could not fit ratecontrol constraints\n");
+ av_log(avctx, AV_LOG_ERROR,
+ "picture could not fit ratecontrol constraints, increase qmax\n");
return -1;
}