Mercurial > libavcodec.hg
changeset 5969:c5d11f6f6a3d libavcodec
fix corner case when qscale 1 bits < frame bits but max bits with worst padding > frame bits
author | bcoudurier |
---|---|
date | Sun, 02 Dec 2007 19:20:46 +0000 |
parents | 3f452f275542 |
children | e1ac22f75cf6 |
files | dnxhdenc.c |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/dnxhdenc.c Sun Dec 02 18:44:29 2007 +0000 +++ b/dnxhdenc.c Sun Dec 02 19:20:46 2007 +0000 @@ -671,7 +671,7 @@ // ctx->m.avctx->frame_number, qscale, bits, ctx->frame_bits, last_higher, last_lower); if (bits < ctx->frame_bits) { if (qscale == 1) - break; + return 1; if (last_higher == qscale - 1) { qscale = last_higher; break; @@ -710,8 +710,8 @@ static int dnxhd_encode_variance(AVCodecContext *avctx, DNXHDEncContext *ctx) { int max_bits = 0; - int x, y; - if (dnxhd_find_qscale(ctx) < 0) + int ret, x, y; + if ((ret = dnxhd_find_qscale(ctx)) < 0) return -1; for (y = 0; y < ctx->m.mb_height; y++) { for (x = 0; x < ctx->m.mb_width; x++) { @@ -730,7 +730,7 @@ } max_bits += 31; //worst padding } - if (max_bits > ctx->frame_bits) { + if (!ret) { if (RC_VARIANCE) avctx->execute(avctx, dnxhd_mb_var_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count); qsort(ctx->mb_cmp, ctx->m.mb_num, sizeof(RCEntry), dnxhd_rc_cmp);