[FFmpeg-devel] [PATCH] more libx264 parameters

Michael Niedermayer michaelni
Thu Mar 18 17:07:09 CET 2010


On Wed, Mar 17, 2010 at 05:06:59PM -0700, Baptiste Coudurier wrote:
> Hi all,
>
> -flags2 +psy (activated by default)
> -psy_rd <float>
> -psy_trellis <float>
> -aq_mode <int>
> -ssim
> -aq_strength <float>
> -rc_lookahead <int>
>
> Please tell me if documentation is not adequate.

i think some need slightly more elaborate docs

but first, do we need a psy flag, is not setting some of the float parameters
to 0 naturally disabling it? no i am not upto date with x264 encoding options


>
> -- 
> Baptiste COUDURIER
> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
> FFmpeg maintainer                                  http://www.ffmpeg.org

>  avcodec.h |   36 +++++++++++++++++++++++++++++++++++-
>  libx264.c |   15 ++++++++++++++-
>  options.c |   11 +++++++++--
>  3 files changed, 58 insertions(+), 4 deletions(-)
> b4f4f629d21ad1d28deba1146367310aa0a1e58d  x264_options.patch
> Index: libavcodec/avcodec.h
> ===================================================================
> --- libavcodec/avcodec.h	(revision 22565)
> +++ libavcodec/avcodec.h	(working copy)
> @@ -30,7 +30,7 @@
>  #include "libavutil/avutil.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR 52
> -#define LIBAVCODEC_VERSION_MINOR 59
> +#define LIBAVCODEC_VERSION_MINOR 60
>  #define LIBAVCODEC_VERSION_MICRO  0
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> @@ -592,6 +592,8 @@
>  #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
>  #define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible
>  #define CODEC_FLAG2_MBTREE        0x00040000 ///< Use macroblock tree ratecontrol (x264 only)
> +#define CODEC_FLAG2_PSY           0x00080000 ///< Use psycho visual optimizations

> +#define CODEC_FLAG2_SSIM          0x00100000 ///< Compute SSIM during encoding

is the value made available through AVFrame.error[] or just printed
to the terminal, printf would be a bit annoying, in light of av_log()
expectance of applications.


>  
>  /* Unsupported options :
>   *              Syntax Arithmetic coding (SAC)

> @@ -2598,6 +2600,38 @@
>       * - decoding: unused
>       */
>      int weighted_p_pred;
> +
> +    /**
> +     * AQ mode
> +     * 0: Disabled
> +     * 1: Variance AQ (complexity mask)
> +     * 2: Auto-variance AQ (experimental)
> +     */
> +    int aq_mode;
> +
> +    /**
> +     * AQ strength
> +     * Reduces blocking and blurring in flat and textured areas. [1.0]
> +     */
> +    float aq_strength;

is this semantically different from our *cplx_mask fields?


> +
> +    /**
> +     * PSY rd
> +     * Strength of psychovisual optimization
> +     */
> +    float psy_rd;
> +
> +    /**
> +     * PSY trellis
> +     * Strength of psychovisual optimization
> +     */
> +    float psy_trellis;

the same documentation for 2 different options isnt ideal



> +
> +    /**
> +     * RC lookahead
> +     * Number of frames for frametype lookahead

ratecontrol or frametype lookahead or both?
anyway our b frame code (estimate_best_b_count() and surrounding
needs a update with this currently our lookahead is not seperate from
the maximum b frame count.
Such update of course is seperate from this patch, iam just mentioning it
(a "//FIXME" would probably be good so the update is not forgotten)


> +     */
> +    int rc_lookahead;
>  } AVCodecContext;
>  
>  /**
> Index: libavcodec/options.c
> ===================================================================
> --- libavcodec/options.c	(revision 22565)
> +++ libavcodec/options.c	(working copy)

> @@ -69,7 +69,7 @@
>  {"emu_edge", "don't draw edges", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_EMU_EDGE, INT_MIN, INT_MAX, 0, "flags"},
>  {"psnr", "error[?] variables will be set during encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PSNR, INT_MIN, INT_MAX, V|E, "flags"},
>  {"truncated", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRUNCATED, INT_MIN, INT_MAX, 0, "flags"},
> -{"naq", "normalize adaptive quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_NORMALIZE_AQP, INT_MIN, INT_MAX, V|E, "flags"},
> +{"naq", "normalize adaptive quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_NORMALIZE_AQP, INT_MIN, INT_MAX, V|E, "flags2"},

typo ?


>  {"ildct", "use interlaced dct", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_DCT, INT_MIN, INT_MAX, V|E, "flags"},
>  {"low_delay", "force low delay", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOW_DELAY, INT_MIN, INT_MAX, V|D|E, "flags"},
>  {"alt", "enable alternate scantable (mpeg2/mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_ALT_SCAN, INT_MIN, INT_MAX, V|E, "flags"},
> @@ -307,7 +307,7 @@
>  {"nr", "noise reduction", OFFSET(noise_reduction), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
>  {"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
>  {"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
> -{"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_BIT_RESERVOIR, 0, UINT_MAX, V|A|E|D, "flags2"},
> +{"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_BIT_RESERVOIR|CODEC_FLAG2_PSY, 0, UINT_MAX, V|A|E|D, "flags2"},
>  {"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
>  {"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "aa"},
>  {"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_AUTO, INT_MIN, INT_MAX, V|D, "aa"},
> @@ -404,7 +404,14 @@
>  {"colorspace", NULL, OFFSET(colorspace), FF_OPT_TYPE_INT, AVCOL_SPC_UNSPECIFIED, 1, AVCOL_SPC_NB-1, V|E|D},
>  {"color_range", NULL, OFFSET(color_range), FF_OPT_TYPE_INT, AVCOL_RANGE_UNSPECIFIED, 0, AVCOL_RANGE_NB-1, V|E|D},
>  {"chroma_sample_location", NULL, OFFSET(chroma_sample_location), FF_OPT_TYPE_INT, AVCHROMA_LOC_UNSPECIFIED, 0, AVCHROMA_LOC_NB-1, V|E|D},
> +{"psy", "use psycho visual optimization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_PSY, INT_MIN, INT_MAX, V|E, "flags2"},
> +{"psy_rd", "specify psycho visual strength", OFFSET(psy_rd), FF_OPT_TYPE_FLOAT, 1.0, 0, FLT_MAX, V|E},
> +{"psy_trellis", "specify psycho visual trellis", OFFSET(psy_trellis), FF_OPT_TYPE_FLOAT, 0, 0, FLT_MAX, V|E},
> +{"aq_mode", "specify aq method", OFFSET(aq_mode), FF_OPT_TYPE_INT, 1, 0, INT_MAX, V|E},
> +{"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, 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, 40, 0, INT_MAX, V|E},

>  {NULL},
> +{"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_SSIM, INT_MIN, INT_MAX, V|E, "flags2"},
>  };

i assume this isnt supposed to be after NULL?


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100318/31f01ff1/attachment.pgp>



More information about the ffmpeg-devel mailing list