[SCM] libav/master: proresenc: Properly account for alpha plane

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Wed Sep 17 01:18:07 UTC 2014


The following commit has been merged in the master branch:
commit 41e1354c101004ccd46dc08d3dd6e956e83a6b51
Author: Christophe Gisquet <christophe.gisquet at gmail.com>
Date:   Mon Aug 18 14:15:24 2014 +0000

    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 at libav.org
    
    Signed-off-by: Diego Biurrun <diego at biurrun.de>
    Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c
index 262f0ba..3a82c2c 100644
--- a/libavcodec/proresenc.c
+++ b/libavcodec/proresenc.c
@@ -1246,8 +1246,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 *
@@ -1256,6 +1254,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,

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list