+ * Advanced parameter handling functions
+ ****************************************************************************/
+
+/* These functions expose the full power of x264's preset-tune-profile system for
+ * easy adjustment of large numbers of internal parameters.
+ *
+ * In order to replicate x264CLI's option handling, these functions MUST be called
+ * in the following order:
+ * 1) x264_param_default_preset
+ * 2) Custom user options (via param_parse or directly assigned variables)
+ * 3) x264_param_apply_fastfirstpass
+ * 4) x264_param_apply_profile
+ *
+ * Additionally, x264CLI does not apply step 3 if the preset chosen is "placebo"
+ * or --slow-firstpass is set. */
+
+/* x264_param_default_preset:
+ * The same as x264_param_default, but also use the passed preset and tune
+ * to modify the default settings.
+ * (either can be NULL, which implies no preset or no tune, respectively)
+ *
+ * Currently available presets are, ordered from fastest to slowest: */
+static const char * const x264_preset_names[] = { "ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo", 0 };
+
+/* The presets can also be indexed numerically, as in:
+ * x264_param_default_preset( ¶m, "3", ... )
+ * with ultrafast mapping to "0" and placebo mapping to "9". This mapping may
+ * of course change if new presets are added in between, but will always be
+ * ordered from fastest to slowest.
+ *
+ * Warning: the speed of these presets scales dramatically. Ultrafast is a full
+ * 100 times faster than placebo!
+ *
+ * Currently available tunings are: */
+static const char * const x264_tune_names[] = { "film", "animation", "grain", "stillimage", "psnr", "ssim", "fastdecode", "zerolatency", 0 };
+
+/* Multiple tunings can be used if separated by a delimiter in ",./-+",
+ * however multiple psy tunings cannot be used.
+ * film, animation, grain, stillimage, psnr, and ssim are psy tunings.
+ *
+ * returns 0 on success, negative on failure (e.g. invalid preset/tune name). */
+int x264_param_default_preset( x264_param_t *, const char *preset, const char *tune );
+
+/* x264_param_apply_fastfirstpass:
+ * If first-pass mode is set (rc.b_stat_read == 0, rc.b_stat_write == 1),
+ * modify the encoder settings to disable options generally not useful on
+ * the first pass. */
+void x264_param_apply_fastfirstpass( x264_param_t * );
+
+/* x264_param_apply_profile:
+ * Applies the restrictions of the given profile.
+ * Currently available profiles are, from most to least restrictive: */
+static const char * const x264_profile_names[] = { "baseline", "main", "high", "high10", "high422", "high444", 0 };
+
+/* (can be NULL, in which case the function will do nothing)
+ *
+ * Does NOT guarantee that the given profile will be used: if the restrictions
+ * of "High" are applied to settings that are already Baseline-compatible, the
+ * stream will remain baseline. In short, it does not increase settings, only
+ * decrease them.
+ *
+ * returns 0 on success, negative on failure (e.g. invalid profile name). */
+int x264_param_apply_profile( x264_param_t *, const char *profile );
+
+/****************************************************************************
+ * Picture structures and functions