shithub: libvpx

Download patch

ref: d66bd225263c7f644ff886bb7b1a4743a633385f
parent: 1d3ca088f669aeee5ed638ba1964d02aaf779974
author: Alex Converse <[email protected]>
date: Fri Feb 21 05:52:09 EST 2014

Require an --experimental-bitstream flag at runtime for encoding profile 1.

Change-Id: I73865bbbf6ea74434f15b73783ae97b4d273be80

--- a/vpxenc.c
+++ b/vpxenc.c
@@ -231,7 +231,11 @@
 static const arg_def_t disable_warning_prompt =
     ARG_DEF("y", "disable-warning-prompt", 0,
             "Display warnings, but do not prompt user to continue.");
+static const arg_def_t experimental_bitstream =
+    ARG_DEF(NULL, "experimental-bitstream", 0,
+            "Allow experimental bitstream features.");
 
+
 static const arg_def_t *main_args[] = {
   &debugmode,
   &outputfile, &codecarg, &passes, &pass_arg, &fpf_name, &limit, &skip,
@@ -713,6 +717,8 @@
       global->disable_warnings = 1;
     else if (arg_match(&arg, &disable_warning_prompt, argi))
       global->disable_warning_prompt = 1;
+    else if (arg_match(&arg, &experimental_bitstream, argi))
+      global->experimental_bitstream = 1;
     else
       argj++;
   }
@@ -1002,13 +1008,20 @@
   } while (0)
 
 
-static void validate_stream_config(struct stream_state *stream) {
-  struct stream_state *streami;
+static void validate_stream_config(const struct stream_state *stream,
+                                   const struct VpxEncoderConfig *global) {
+  const struct stream_state *streami;
 
   if (!stream->config.cfg.g_w || !stream->config.cfg.g_h)
     fatal("Stream %d: Specify stream dimensions with --width (-w) "
           " and --height (-h)", stream->index);
 
+  if (stream->config.cfg.g_profile != 0 && !global->experimental_bitstream) {
+    fatal("Stream %d: profile %d is experimental and requires the --%s flag",
+          stream->index, stream->config.cfg.g_profile,
+          experimental_bitstream.long_name);
+  }
+
   for (streami = stream; streami; streami = streami->next) {
     /* All streams require output files */
     if (!streami->config.out_fn)
@@ -1571,7 +1584,7 @@
       fatal("Specify stream dimensions with --width (-w) "
             " and --height (-h)");
     FOREACH_STREAM(set_stream_dimensions(stream, input.width, input.height));
-    FOREACH_STREAM(validate_stream_config(stream));
+    FOREACH_STREAM(validate_stream_config(stream, &global));
 
     /* Ensure that --passes and --pass are consistent. If --pass is set and
      * --passes=2, ensure --fpf was set.
--- a/vpxenc.h
+++ b/vpxenc.h
@@ -46,6 +46,7 @@
   int show_rate_hist_buckets;
   int disable_warnings;
   int disable_warning_prompt;
+  int experimental_bitstream;
 };
 
 #ifdef __cplusplus