[FFmpeg-devel] [RFC] Specifying KEYINT (-g) has no effect in libx264

Etienne Buira etienne.buira.lists at free.fr
Wed Jun 8 21:44:02 CEST 2011


Hi, thank you for resurecting this patch.

On Wed, Jun 08, 2011 at 10:47:16AM +0200, Stefano Sabatini wrote:
> > +    for (o = options; o->name; o++)
> > +        if (o->type == FF_OPT_TYPE_STRING)
> > +            av_free(*(char **) (((uint8_t*)x4)+o->offset));
> 
> This is not anymore necessary now that av_opt_free() is called.

Updated.

> > +static struct {
> > +    const char *name;
> > +    unsigned int partitionflag;
> > +} x264partitions[] = {
> > +    {"i4x4", X264_ANALYSE_I4x4},
> > +    {"i8x8", X264_ANALYSE_I8x8},
> > +    {"p8x8", X264_ANALYSE_PSUB16x16},
> > +    {"p4x4", X264_ANALYSE_PSUB8x8},
> > +    {"b8x8", X264_ANALYSE_BSUB16x16},
> > +    {NULL},
> > +};
> 
> As I suggested, you could put this in options:
>     {"partitions", "macroblock subpartition sizes to consider", OFFSET(partitions), FF_OPT_TYPE_FLAGS, {.dbl = 0 }, INT_MIN, INT_MAX, VE, "partitions"},
>     {"b8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_ANALYSE_BSUB16x16 }, INT_MIN, INT_MAX, VE, "partitions"},
>     {"i4x4", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_ANALYSE_I4x4      }, INT_MIN, INT_MAX, VE, "partitions"},
>     {"i8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_ANALYSE_I8x8      }, INT_MIN, INT_MAX, VE, "partitions"},
>     {"p4x4", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_ANALYSE_PSUB8x8   }, INT_MIN, INT_MAX, VE, "partitions"},
>     {"p8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_ANALYSE_PSUB16x16 }, INT_MIN, INT_MAX, VE, "partitions"},

Not possible without introducing special case (==0 interpreted as no
partitions set on cmdline, but then needs to be a special case in doc
and might lead to silent surprises).

> and while at it deprecate the corresponding option in AVCodecContext.

It's used in libavcodec/libxavs.c as well.

> > +    /* FIXME: grep for CODEC_FLAG */
> 
> I hate FIXMEs (and they are doomed to stay unfixed forever), please
> explain what this means.

Leaving flags for now was suggested by Baptiste after I proposed a
definitely not cute OPT_FLAG. Stating it as a fixme is still better than
letting other people guess. This patch still fixes some things and does
not break anyone AFAIK.

> > +    if (x4->deblockbeta) {
> > +        if (sscanf(x4->deblockbeta, "%d", &x4->params.i_deblocking_filter_beta) != 1) {
> > +            av_log(avctx, AV_LOG_ERROR, "Bad value for deblockbeta (should be an int)\n");
> > +            return -1;
> 
> AVERROR(EINVAL)

Done in code I added, changing those in existing code should be made in
another patch IMHO.

> Can someone explain why some options can be set with OPT_STR and others
> need to be directly set on x4->params?

Depends.
For flags, I left tem as is.
For deblockbeta, x264 parsing code wants it paired with deblockalpha. So
not sure what looks better, the way it is or the OPT_STR2 I proposed
earlier in this thread.
For ip_factor, it has to be inverted.

> > +    if (x4->directpred) {
> > +        if (isdigit(x4->directpred[0])) {
> > +            int i, v = atoi(x4->directpred);
> > +            for (i=0 ; x264_direct_pred_names[i] && i<v ; i++);
> > +            if (i==v) {
> > +                OPT_STR("direct-pred", x264_direct_pred_names[i]);
> > +            } else {
> > +                av_log(avctx, AV_LOG_ERROR, "Wrong value for directpred\n");
> > +                return -1;
> > +            }
> > +        } else
> > +            OPT_STR("direct-pred", x4->directpred);
> > +    }
> 
> That's a weird way of parsing code. Isn't this directly handled by
> x264_param_parse() (or in other way: why all the applications have to
> parse this again and again)?

Well, going to x264_param_parse needs to pass strings. Translating from
legacy ffmpeg arguments if needed. It is the case here (though, I can
send a patch to x264 to make parse_enum (in common/common.c) accepts
integer, but not sure they will like it).

> BTW, can someone explain what happen when
> x264_param_parse(&x4->params, opt, NULL)
> is called with a NULL argument? I suppose the default value is set. 

Unconditionaly set to "true".

> > +    x4->params.analyse.b_weighted_bipred = avctx->flags2 & CODEC_FLAG2_WPRED;
> > +    if (x4->me_method) {
> > +        if (!strcmp(x4->me_method, "epzs")) {
> > +            OPT_STR("me", "dia");
> > +        } else if (!strcmp(x4->me_method, "full")) {
> > +            OPT_STR("me", "esa");
> > +        } else
> > +            OPT_STR("me", x4->me_method);
> > +    }
> 
> Same here, I'd like to avoid this mapping, unless the new mapping will
> not break previous commandlines/preset, even in this case I'd like to
> put this under and #if LIBAVCODEC_VERSION < NEXT.

Same answer as for directpred.

> > +    if (x4->psy_trellis) {
> > +        if (sscanf(x4->psy_trellis, "%f", &x4->params.analyse.f_psy_trellis) != 1) {
> > +            av_log(avctx, AV_LOG_ERROR, "Bad value for psy_trellis (should be a float)\n");
> > +            return -1;
> 
> AVERROR(EINVAL).
> 
> > +        }
> > +    }
> 
> Again, why can't we set this with OPT_STR?  Also what prevents to use
> AVOptions for parsing the value, and directly set it in
> &x4->params.analyse.f_psy_trellis?
> (You would need to define the option with AV_OPT_TYPE_FLOAT).

Same as deblockbeta answer.

> > +            av_log(avctx, AV_LOG_ERROR, "Invalid i_qfactor\n");
> 
> Best practices recommend to say which is the failing value for a
> better feedback.

Yep, done.

> > +        snprintf(param, 254, "%f", 1/fabs(f));
>                            ^^^
> sizeof(param)-1

OK, done.

Baptiste, I have seen your comment about that, and my manpage says the
same as yours, but I think it should not be too hard to see
implementations with different interpretation about including the '\0'
in the limit.
Anyway, I lowered the buffer size to 64, and it is still way big enough
to hold a float (default precision, GNU implementation is 6 digits).




But globally I think we go nowhere with this patch. Here are the options
I see:
1. Go back to -vpre for all presets
   I don't think there is much trouble in maintaining presets that match
   x264 vals. It should not be too hard to implement a script that check
   values are still accurate (eventually linked in fate).
2. Leave as this, with or without the current patch
   Everybody will agree to disagree, either is really not respecting the
   principle of least surprise (or will not look good if I reintroduce
   OPT_STR2 and OPT_FLAG).
3. Make change to avoptions, I see two ways of doing:
   1. Add an optional int in AVOption struct that will point to a value
      defaulted to 0 at first, and set to 1 for usual values, or ORed
      with the matching flag wether or not the flag is '+' or '-'.
   2. Make the parsing continue looking for options to make the following
      pseudo example work.
      {"flags", "tada", OFFSET(flags_set), FF_OPT_TYPE_FLAGS, {.dbl=0), [...], "flags"},
      {"flags", NULL, OFFSSET(flags_unset), FF_OPT_TYPE_FLAGS, {.dbl=0xffff}, [...], "flags"},
      ...
   But I don't see any of the two be welcomed.
4. If breaking arguments, do it completely, only allowing -x264opts. I
   don't know if it is easy to error if other options are given with
   current avoptions though.

My favourite is to go for 1, or 3 if such modifications would be
welcomed (didn't have answer when I suggested it earlier).


Comments welcome on way to go and patch.

upa.
-------------- next part --------------
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 1b6f55f..bbcb49c 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -20,6 +20,7 @@
  */
 
 #include "libavutil/opt.h"
+#include "libavutil/avstring.h"
 #include "avcodec.h"
 #include <x264.h>
 #include <math.h>
@@ -43,6 +44,55 @@ typedef struct X264Context {
     char *stats;
     char *weightp;
     char *x264opts;
+    char *keyint_max;
+    char *bframes;
+    char *cabac;
+    char *badapt;
+    char *bbias;
+    char *keyintmin;
+    char *scenecut;
+    char *deblockalpha;
+    char *deblockbeta;
+    char *qpmin;
+    char *qpmax;
+    char *qpstep;
+    char *qcomp;
+    char *qblur;
+    char *cplxblur;
+    char *ref;
+    char *partitions;
+    char *directpred;
+    char *me_method;
+    char *aqmode;
+    char *aqstrength;
+    char *rc_lookahead;
+    char *psy_rd;
+    char *psy_trellis;
+    char *me_range;
+    char *subq;
+    char *chroma_me;
+    char *trellis;
+    char *nr;
+    char *ip_factor;
+    char *pb_factor;
+    char *chromaoffset;
+    char *slices;
+    char *flags, *flags2;
+    char *psnr;
+    char *b_pyramid;
+    char *wpred;
+    char *psy;
+    char *mixed_refs;
+    char *dct8x8;
+    char *fast_pskip;
+    char *mb_tree;
+    char *intra_refresh;
+    char *ssim;
+    char *aud;
+    char *interlaced;
+    char *opengop;
+    char *repeatheaders;
+    int flags_set, flags_unset;
 } X264Context;
 
 static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -207,6 +257,18 @@ static void check_default_settings(AVCodecContext *avctx)
         }                                                               \
     } while (0);                                                        \
 
+static struct {
+    const char *name;
+    unsigned int partitionflag;
+} x264partitions[] = {
+    {"i4x4", X264_ANALYSE_I4x4},
+    {"i8x8", X264_ANALYSE_I8x8},
+    {"p8x8", X264_ANALYSE_PSUB16x16},
+    {"p4x4", X264_ANALYSE_PSUB8x8},
+    {"b8x8", X264_ANALYSE_BSUB16x16},
+    {NULL},
+};
+
 static av_cold int X264_init(AVCodecContext *avctx)
 {
     X264Context *x4 = avctx->priv_data;
@@ -214,87 +276,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
     x4->sei_size = 0;
     x264_param_default(&x4->params);
 
-    x4->params.i_keyint_max         = avctx->gop_size;
-
-    x4->params.i_bframe          = avctx->max_b_frames;
-    x4->params.b_cabac           = avctx->coder_type == FF_CODER_TYPE_AC;
-    x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
-    x4->params.i_bframe_bias     = avctx->bframebias;
-    x4->params.i_bframe_pyramid  = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
-
-    x4->params.i_keyint_min = avctx->keyint_min;
-    if (x4->params.i_keyint_min > x4->params.i_keyint_max)
-        x4->params.i_keyint_min = x4->params.i_keyint_max;
-
-    x4->params.i_scenecut_threshold        = avctx->scenechange_threshold;
-
-    x4->params.b_deblocking_filter         = avctx->flags & CODEC_FLAG_LOOP_FILTER;
-    x4->params.i_deblocking_filter_alphac0 = avctx->deblockalpha;
-    x4->params.i_deblocking_filter_beta    = avctx->deblockbeta;
-
-    x4->params.rc.i_qp_min                 = avctx->qmin;
-    x4->params.rc.i_qp_max                 = avctx->qmax;
-    x4->params.rc.i_qp_step                = avctx->max_qdiff;
-
-    x4->params.rc.f_qcompress       = avctx->qcompress; /* 0.0 => cbr, 1.0 => constant qp */
-    x4->params.rc.f_qblur           = avctx->qblur;     /* temporally blur quants */
-    x4->params.rc.f_complexity_blur = avctx->complexityblur;
-
-    x4->params.i_frame_reference    = avctx->refs;
-
-    x4->params.analyse.inter    = 0;
-    if (avctx->partitions) {
-        if (avctx->partitions & X264_PART_I4X4)
-            x4->params.analyse.inter |= X264_ANALYSE_I4x4;
-        if (avctx->partitions & X264_PART_I8X8)
-            x4->params.analyse.inter |= X264_ANALYSE_I8x8;
-        if (avctx->partitions & X264_PART_P8X8)
-            x4->params.analyse.inter |= X264_ANALYSE_PSUB16x16;
-        if (avctx->partitions & X264_PART_P4X4)
-            x4->params.analyse.inter |= X264_ANALYSE_PSUB8x8;
-        if (avctx->partitions & X264_PART_B8X8)
-            x4->params.analyse.inter |= X264_ANALYSE_BSUB16x16;
-    }
-
-    x4->params.analyse.i_direct_mv_pred  = avctx->directpred;
-
-    x4->params.analyse.b_weighted_bipred = avctx->flags2 & CODEC_FLAG2_WPRED;
-
-    if (avctx->me_method == ME_EPZS)
-        x4->params.analyse.i_me_method = X264_ME_DIA;
-    else if (avctx->me_method == ME_HEX)
-        x4->params.analyse.i_me_method = X264_ME_HEX;
-    else if (avctx->me_method == ME_UMH)
-        x4->params.analyse.i_me_method = X264_ME_UMH;
-    else if (avctx->me_method == ME_FULL)
-        x4->params.analyse.i_me_method = X264_ME_ESA;
-    else if (avctx->me_method == ME_TESA)
-        x4->params.analyse.i_me_method = X264_ME_TESA;
-    else x4->params.analyse.i_me_method = X264_ME_HEX;
-
-    x4->params.rc.i_aq_mode               = avctx->aq_mode;
-    x4->params.rc.f_aq_strength           = avctx->aq_strength;
-    x4->params.rc.i_lookahead             = avctx->rc_lookahead;
-
-    x4->params.analyse.b_psy              = avctx->flags2 & CODEC_FLAG2_PSY;
-    x4->params.analyse.f_psy_rd           = avctx->psy_rd;
-    x4->params.analyse.f_psy_trellis      = avctx->psy_trellis;
-
-    x4->params.analyse.i_me_range         = avctx->me_range;
-    x4->params.analyse.i_subpel_refine    = avctx->me_subpel_quality;
 
-    x4->params.analyse.b_mixed_references = avctx->flags2 & CODEC_FLAG2_MIXED_REFS;
-    x4->params.analyse.b_chroma_me        = avctx->me_cmp & FF_CMP_CHROMA;
-    x4->params.analyse.b_transform_8x8    = avctx->flags2 & CODEC_FLAG2_8X8DCT;
-    x4->params.analyse.b_fast_pskip       = avctx->flags2 & CODEC_FLAG2_FASTPSKIP;
-
-    x4->params.analyse.i_trellis          = avctx->trellis;
-    x4->params.analyse.i_noise_reduction  = avctx->noise_reduction;
-
-    x4->params.rc.b_mb_tree               = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
-    x4->params.rc.f_ip_factor             = 1 / fabs(avctx->i_quant_factor);
-    x4->params.rc.f_pb_factor             = avctx->b_quant_factor;
-    x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
+    /* FIXME: flags options set by preset are overwritten by ffmpeg's
+     *        defaults if not stated in cmdline. Look for CODEC_FLAG */
 
     if (!x4->preset)
         check_default_settings(avctx);
@@ -309,7 +293,108 @@ static av_cold int X264_init(AVCodecContext *avctx)
     x4->params.i_log_level          = X264_LOG_DEBUG;
 
     OPT_STR("weightp", x4->weightp);
-
+    OPT_STR("keyint", x4->keyint_max);
+    OPT_STR("bframes", x4->bframes);
+    if (x4->cabac) {
+        if (!strcmp(x4->cabac, "ac") || !strcmp(x4->cabac, "1")) {
+            OPT_STR("cabac", "1");
+        } else {
+            OPT_STR("cabac", "0");
+        }
+    }
+    OPT_STR("b-adapt", x4->badapt);
+    OPT_STR("b-bias", x4->bbias);
+    x4->params.i_bframe_pyramid  = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
+    OPT_STR("keyint-min", x4->keyintmin);
+    OPT_STR("scenecut", x4->scenecut);
+    x4->params.b_deblocking_filter         = avctx->flags & CODEC_FLAG_LOOP_FILTER;
+    OPT_STR("deblock", x4->deblockalpha);
+    if (x4->deblockbeta) {
+        if (sscanf(x4->deblockbeta, "%d", &x4->params.i_deblocking_filter_beta) != 1) {
+            av_log(avctx, AV_LOG_ERROR, "Bad value for deblockbeta (should be an int): '%s'\n", x4->deblockbeta);
+            return AVERROR(EINVAL);
+        }
+    }
+    OPT_STR("qpmin", x4->qpmin);
+    OPT_STR("qpmax", x4->qpmax);
+    OPT_STR("qpstep", x4->qpstep);
+    OPT_STR("qcomp", x4->qcomp);    /* 0.0 => cbr, 1.0 => constant qp */
+    OPT_STR("qblur", x4->qblur);    /* temporally blur quants */
+    OPT_STR("cplxblur", x4->cplxblur);
+    OPT_STR("ref", x4->ref);
+    if (x4->partitions) {
+        const char *p = x4->partitions;
+        while (*p) {
+            int i;
+            char sign = *(p++);
+            for (i=0; x264partitions[i].name && !av_strstart(p, x264partitions[i].name, &p); i++);
+            if (!x264partitions[i].name) {
+                av_log(avctx, AV_LOG_ERROR, "Unable to parse partitions (unknown partition name): '%s'\n", p);
+                return AVERROR(EINVAL);
+            }
+            switch(sign) {
+            case '+': x4->params.analyse.inter |= x264partitions[i].partitionflag; break;
+            case '-': x4->params.analyse.inter &= ~x264partitions[i].partitionflag; break;
+            default:  av_log(avctx, AV_LOG_ERROR, "Unable to parse partitions (sign not found): '%s')\n", --p);
+                      return AVERROR(EINVAL);
+            }
+            if (*p == ',') p++;
+        }
+    }
+    if (x4->directpred) {
+        if (isdigit(x4->directpred[0])) {
+            int i, v = atoi(x4->directpred);
+            for (i=0 ; x264_direct_pred_names[i] && i<v ; i++);
+            if (i==v) {
+                OPT_STR("direct-pred", x264_direct_pred_names[i]);
+            } else {
+                av_log(avctx, AV_LOG_ERROR, "Wrong value for directpred: '%s'\n", x4->directpred);
+                return AVERROR(EINVAL);
+            }
+        } else
+            OPT_STR("direct-pred", x4->directpred);
+    }
+    x4->params.analyse.b_weighted_bipred = avctx->flags2 & CODEC_FLAG2_WPRED;
+    if (x4->me_method) {
+        if (!strcmp(x4->me_method, "epzs")) {
+            OPT_STR("me", "dia");
+        } else if (!strcmp(x4->me_method, "full")) {
+            OPT_STR("me", "esa");
+        } else
+            OPT_STR("me", x4->me_method);
+    }
+    OPT_STR("aq-mode", x4->aqmode);
+    OPT_STR("aq-strength", x4->aqstrength);
+    OPT_STR("rc-lookahead", x4->rc_lookahead);
+    x4->params.analyse.b_psy              = avctx->flags2 & CODEC_FLAG2_PSY;
+    OPT_STR("psy-rd", x4->psy_rd);
+    if (x4->psy_trellis) {
+        if (sscanf(x4->psy_trellis, "%f", &x4->params.analyse.f_psy_trellis) != 1) {
+            av_log(avctx, AV_LOG_ERROR, "Bad value for psy_trellis (should be a float): '%s'\n", x4->psy_trellis);
+            return AVERROR(EINVAL);
+        }
+    }
+    OPT_STR("me-range", x4->me_range);
+    OPT_STR("subq", x4->subq);
+    x4->params.analyse.b_mixed_references = avctx->flags2 & CODEC_FLAG2_MIXED_REFS;
+    OPT_STR("chroma-me", x4->chroma_me);
+    x4->params.analyse.b_transform_8x8    = avctx->flags2 & CODEC_FLAG2_8X8DCT;
+    x4->params.analyse.b_fast_pskip       = avctx->flags2 & CODEC_FLAG2_FASTPSKIP;
+    OPT_STR("trellis", x4->trellis);
+    OPT_STR("nr", x4->nr);
+    x4->params.rc.b_mb_tree               = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
+    if (x4->ip_factor) {
+        float f;
+        char param[64];
+        if (sscanf(x4->ip_factor, "%f", &f) != 1) {
+            av_log(avctx, AV_LOG_ERROR, "Invalid i_qfactor: '%s'\n", x4->ip_factor);
+            return AVERROR(EINVAL);
+        }
+        snprintf(param, sizeof(param)-1, "%f", 1/fabs(f));
+        OPT_STR("ip-factor", param);
+    }
+    OPT_STR("pb-factor", x4->pb_factor);
+    OPT_STR("chroma-qp-offset", x4->chromaoffset);
     x4->params.b_intra_refresh      = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
     x4->params.rc.i_bitrate         = avctx->bit_rate       / 1000;
     x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
@@ -379,7 +464,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
 
     x4->params.b_open_gop     = !(avctx->flags & CODEC_FLAG_CLOSED_GOP);
 
-    x4->params.i_slice_count  = avctx->slices;
+    OPT_STR("slices", x4->slices);
 
     x4->params.vui.b_fullrange = avctx->pix_fmt == PIX_FMT_YUVJ420P;
 
@@ -398,7 +483,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
 
     avctx->coded_frame = &x4->out_pic;
 
-    if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
+    if (!x4->params.b_repeat_headers) {
         x264_nal_t *nal;
         int nnal, s, i;
 
@@ -427,6 +512,39 @@ static const AVOption options[] = {
     {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
     {"wpredp", "Weighted prediction for P-frames", OFFSET(weightp), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
     {"x264opts", "x264 options", OFFSET(x264opts), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"g", "Set the group of picture (GOP) size (int)", OFFSET(keyint_max), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"bf", "use 'frames' B frame (int)", OFFSET(bframes), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"coder", "use cabac (1|ac)|0", OFFSET(cabac), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"b_strategy", "strategy to choose between I/P/B-frames (see x264 --fullhelp) (int 0..2)", OFFSET(badapt), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"bframebias", "influences how often B-frames are used (int)", OFFSET(bbias), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"keyint_min", "minimum interval between IDR-frames (int)", OFFSET(keyintmin), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"sc_threshold", "scene change threshold (int)", OFFSET(scenecut), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"deblockalpha", "in-loop deblocking filter alphac0 parameter (int)", OFFSET(deblockalpha), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"deblockbeta", "in-loop deblocking filter beta parameter (int)", OFFSET(deblockbeta), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"qmin", "min video quantizer scale (VBR) (int)", OFFSET(qpmin), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"qmax", "max video quantizer scale (VBR) (int)", OFFSET(qpmax), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"qdiff", "max difference between the quantizer scale (VBR) (int)", OFFSET(qpstep), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"qcomp", "video quantizer scale compression (VBR) (float)", OFFSET(qcomp), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"qblur", "video quantizer scale blur (VBR) (float)", OFFSET(qblur), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"complexityblur", "reduce fluctuations in qp (before curve compression) (float)", OFFSET(cplxblur), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"refs", "reference frames to consider for motion compensation (int)", OFFSET(ref), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"partitions", "macroblock subpartition sizes to consider, list of (+|-)(i4x4|i8x8|p8x8|p4x4|b8x8)", OFFSET(partitions), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"directpred", "direct mv prediction mode - (0|none)|(1|spatial)|(2|temporal)|(3|auto)", OFFSET(directpred), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"me_method", "set motion estimation method (epzs|dia)|hex|umh|(full|esa)|tesa", OFFSET(me_method), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"aq_mode", "specify aq method (int)", OFFSET(aqmode), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"aq_strength", "specify aq strength (float)", OFFSET(aqstrength), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"rc_lookahead", "specify number of frames to look ahead for frametype (int)", OFFSET(rc_lookahead), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"psy_rd", "specify psycho visual strength (float)", OFFSET(psy_rd), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"psy_trellis", "specify psycho visual trellis (float)", OFFSET(psy_trellis), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"me_range", "limit motion vectors range (int)", OFFSET(me_range), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"subq", "sub pel motion estimation quality (int)", OFFSET(subq), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"cmp", "full pel me compare function (bool)", OFFSET(chroma_me), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"trellis", "rate-distortion optimal quantization (int)", OFFSET(trellis), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"nr", "noise reduction (int)", OFFSET(nr), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"i_qfactor", "qp factor between P and I frames (float)", OFFSET(ip_factor), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"b_qfactor", "qp factor between p and b frames (float)", OFFSET(pb_factor), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"chromaoffset", "chroma qp offset from luma (int)", OFFSET(chromaoffset), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+    {"slices", "number of slices, used in parallelized decoding (int)", OFFSET(slices), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
     { NULL },
 };
 
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 78a7bc8..3235c1f 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -120,7 +120,6 @@ static const AVOption options[]={
 {"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E},
 {"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX, V|E},
-{"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX, V|E},
 {"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
 {"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
@@ -358,7 +357,6 @@ static const AVOption options[]={
 {"chromaoffset", "chroma qp offset from luma", OFFSET(chromaoffset), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
-{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)", OFFSET(directpred), FF_OPT_TYPE_INT, {.dbl = 2 }, INT_MIN, INT_MAX, V|E},
 {"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BPYRAMID }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"wpred", "weighted biprediction for b-frames (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_WPRED }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MIXED_REFS }, INT_MIN, INT_MAX, V|E, "flags2"},
@@ -367,8 +365,6 @@ static const AVOption options[]={
 {"aud", "access unit delimiters (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_AUD }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"skiprd", "RD optimal MB level residual skipping", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SKIP_RD }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"complexityblur", "reduce fluctuations in qp (before curve compression)", OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, {.dbl = 20.0 }, FLT_MIN, FLT_MAX, V|E},
-{"deblockalpha", "in-loop deblocking filter alphac0 parameter", OFFSET(deblockalpha), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, -6, 6, V|E},
-{"deblockbeta", "in-loop deblocking filter beta parameter", OFFSET(deblockbeta), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, -6, 6, V|E},
 {"partitions", "macroblock subpartition sizes to consider", OFFSET(partitions), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "partitions"},
 {"parti4x4", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_I4X4 }, INT_MIN, INT_MAX, V|E, "partitions"},
 {"parti8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_I8X8 }, INT_MIN, INT_MAX, V|E, "partitions"},
@@ -409,11 +405,6 @@ static const AVOption options[]={
 {"color_range", NULL, OFFSET(color_range), FF_OPT_TYPE_INT, {.dbl = AVCOL_RANGE_UNSPECIFIED }, 0, AVCOL_RANGE_NB-1, V|E|D},
 {"chroma_sample_location", NULL, OFFSET(chroma_sample_location), FF_OPT_TYPE_INT, {.dbl = AVCHROMA_LOC_UNSPECIFIED }, 0, AVCHROMA_LOC_NB-1, V|E|D},
 {"psy", "use psycho visual optimization", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_PSY }, INT_MIN, INT_MAX, V|E, "flags2"},
-{"psy_rd", "specify psycho visual strength", OFFSET(psy_rd), FF_OPT_TYPE_FLOAT, {.dbl = 1.0 }, 0, FLT_MAX, V|E},
-{"psy_trellis", "specify psycho visual trellis", OFFSET(psy_trellis), FF_OPT_TYPE_FLOAT, {.dbl = 0 }, 0, FLT_MAX, V|E},
-{"aq_mode", "specify aq method", OFFSET(aq_mode), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, INT_MAX, V|E},
-{"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, {.dbl = 1.0 }, 0, FLT_MAX, V|E},
-{"rc_lookahead", "specify number of frames to look ahead for frametype", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, {.dbl = 40 }, 0, INT_MAX, V|E},
 {"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SSIM }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_INTRA_REFRESH }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, V|E},


More information about the ffmpeg-devel mailing list