diff options
author | Christophe Gisquet <christophe.gisquet@gmail.com> | 2014-08-18 14:15:24 +0000 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-08-18 19:03:37 +0200 |
commit | f25f5f8c62ec7728ee7f5dcc8f1abd0dc6235735 (patch) | |
tree | 7042a2fb3d550f4e71a3794a37b8c094e3927baa | |
parent | a437298de55c6a6a4f06b12335b3891bf4459082 (diff) | |
download | ffmpeg-f25f5f8c62ec7728ee7f5dcc8f1abd0dc6235735.tar.gz |
proresenc: Properly account for alpha plane
The packet buffer allocation considers the alpha channel as DCT-coded,
while it is actually run-coded and thus requires a larger buffer.
CC: libav-stable@libav.org
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 41e1354c101004ccd46dc08d3dd6e956e83a6b51)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r-- | libavcodec/proresenc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c index 570a73caa8..a43612cf0e 100644 --- a/libavcodec/proresenc.c +++ b/libavcodec/proresenc.c @@ -1231,8 +1231,6 @@ static av_cold int encode_init(AVCodecContext *avctx) ctx->bits_per_mb = ls * 8; if (ctx->chroma_factor == CFACTOR_Y444) ctx->bits_per_mb += ls * 4; - if (ctx->num_planes == 4) - ctx->bits_per_mb += ls * 4; } ctx->frame_size_upper_bound = ctx->pictures_per_frame * @@ -1241,6 +1239,14 @@ static av_cold int encode_init(AVCodecContext *avctx) (mps * ctx->bits_per_mb) / 8) + 200; + if (ctx->alpha_bits) { + // The alpha plane is run-coded and might exceed the bit budget. + ctx->frame_size_upper_bound += ctx->pictures_per_frame * + ctx->slices_per_picture * + /* num pixels per slice */ (ctx->mbs_per_slice * 256 * + /* bits per pixel */ (1 + ctx->alpha_bits + 1) + 7 >> 3); + } + avctx->codec_tag = ctx->profile_info->tag; av_log(avctx, AV_LOG_DEBUG, |