[FFmpeg-devel] PATCH: Flag to disable mb-tree (libx264)

ReikoShea reikoshea
Mon Aug 17 22:01:39 CEST 2009


With the newer versions of libx264, mb tree ratecontrol is enabled by
default. That, however, breaks some of the functionality in presets with
no way to get around it. Using b-pyramid, for example, doesn't do
anything since it will automatically be disabled since you are using mb
tree ratecontrol.  The following patch will allow -mbtree 0 (off) to be
passed. The default is set to 1 (on) (at Dark_Shikari's request).

--- /home/user/libavcodec/avcodec.h 2009-08-14 09:16:45.000000000 -0500
+++ ./avcodec.h 2009-08-17 09:53:14.000000000 -0500
@@ -2457,6 +2457,13 @@
     float rc_min_vbv_overflow_use;

     /**
+     * Macroblock tree ratecontrol
+     * 0=off
+     * 1=on (DEFAULT)
+     */
+    int mbtree;
+
+    /**
      * Hardware accelerator in use
      * - encoding: unused.
      * - decoding: Set by libavcodec
--- /home/user/libavcodec/libx264.c 2009-08-14 09:16:46.000000000 -0500
+++ ./libx264.c 2009-08-17 09:47:26.000000000 -0500
@@ -188,6 +188,8 @@
     x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
     x4->params.i_bframe_bias = avctx->bframebias;
     x4->params.b_bframe_pyramid = avctx->flags2 & CODEC_FLAG2_BPYRAMID;
+    x4->params.rc.b_mb_tree = avctx->mbtree;
+
     avctx->has_b_frames= avctx->flags2 & CODEC_FLAG2_BPYRAMID ? 2 : !!
avctx->max_b_frames;

     x4->params.i_keyint_min = avctx->keyint_min;
--- /home/user/libavcodec/options.c 2009-08-14 09:16:46.000000000 -0500
+++ ./options.c 2009-08-17 09:45:06.000000000 -0500
@@ -363,6 +363,7 @@
{"fastpskip", "fast pskip (H.264)", 0, FF_OPT_TYPE_CONST,
CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|E, "flags2"},
{"aud", "access unit delimiters (H.264)", 0, FF_OPT_TYPE_CONST,
CODEC_FLAG2_AUD, INT_MIN, INT_MAX, V|E, "flags2"},
{"skiprd", "RD optimal MB level residual skipping", 0,
FF_OPT_TYPE_CONST, CODEC_FLAG2_SKIP_RD, INT_MIN, INT_MAX, V|E,
"flags2"},
+{"mbtree", "macroblock tree ratecontrol", OFFSET(mbtree),
FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E},
{"complexityblur", "reduce fluctuations in qp (before curve
compression)", OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, 20.0, FLT_MIN,
FLT_MAX, V|E},
{"deblockalpha", "in-loop deblocking filter alphac0 parameter",
OFFSET(deblockalpha), FF_OPT_TYPE_INT, DEFAULT, -6, 6, V|E},
{"deblockbeta", "in-loop deblocking filter beta parameter",
OFFSET(deblockbeta), FF_OPT_TYPE_INT, DEFAULT, -6, 6, V|E},




More information about the ffmpeg-devel mailing list