summaryrefslogtreecommitdiffstats
path: root/libavcodec/dnxhdenc.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-12-02 19:20:46 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-12-02 19:20:46 +0000
commit78532b052dfb0961d1f6a5c2b0a8fa6a53a3731a (patch)
tree6e0bd4770307c55abb8dd8280714b89d6b1e578f /libavcodec/dnxhdenc.c
parent79cf2c7e86ce1c5c2095c3cb3f0cc7c5d751a84a (diff)
downloadffmpeg-streaming-78532b052dfb0961d1f6a5c2b0a8fa6a53a3731a.zip
ffmpeg-streaming-78532b052dfb0961d1f6a5c2b0a8fa6a53a3731a.tar.gz
fix corner case when qscale 1 bits < frame bits but max bits with worst padding > frame bits
Originally committed as revision 11131 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dnxhdenc.c')
-rw-r--r--libavcodec/dnxhdenc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index dc55ae0..1041534 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -671,7 +671,7 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx)
// 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_rc_cmp(const void *a, const void *b)
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 @@ static int dnxhd_encode_variance(AVCodecContext *avctx, DNXHDEncContext *ctx)
}
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);
OpenPOWER on IntegriCloud