|
|
@ -682,7 +682,8 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx) |
|
|
|
int qscale = 1; |
|
|
|
int qscale = 1; |
|
|
|
int mb = y*ctx->m.mb_width+x; |
|
|
|
int mb = y*ctx->m.mb_width+x; |
|
|
|
for (q = 1; q < avctx->qmax; q++) { |
|
|
|
for (q = 1; q < avctx->qmax; q++) { |
|
|
|
unsigned score = ctx->mb_rc[q][mb].bits*lambda+(ctx->mb_rc[q][mb].ssd<<LAMBDA_FRAC_BITS); |
|
|
|
unsigned score = ctx->mb_rc[q][mb].bits*lambda+ |
|
|
|
|
|
|
|
((unsigned)ctx->mb_rc[q][mb].ssd<<LAMBDA_FRAC_BITS); |
|
|
|
if (score < min) { |
|
|
|
if (score < min) { |
|
|
|
min = score; |
|
|
|
min = score; |
|
|
|
qscale = q; |
|
|
|
qscale = q; |
|
|
@ -709,7 +710,7 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx) |
|
|
|
lambda = (lambda+last_higher)>>1; |
|
|
|
lambda = (lambda+last_higher)>>1; |
|
|
|
else |
|
|
|
else |
|
|
|
lambda -= down_step; |
|
|
|
lambda -= down_step; |
|
|
|
down_step *= 5; // XXX tune ?
|
|
|
|
down_step = FFMIN((int64_t)down_step*5, INT_MAX); |
|
|
|
up_step = 1<<LAMBDA_FRAC_BITS; |
|
|
|
up_step = 1<<LAMBDA_FRAC_BITS; |
|
|
|
lambda = FFMAX(1, lambda); |
|
|
|
lambda = FFMAX(1, lambda); |
|
|
|
if (lambda == last_lower) |
|
|
|
if (lambda == last_lower) |
|
|
|