shithub: libvpx

Download patch

ref: f990b35fa4de51100949e568848c814c55148415
parent: 877fac122b283455cf699e41e2fd4d455ef122dc
author: Yaowu Xu <[email protected]>
date: Mon Jun 1 05:13:59 EDT 2015

Make vp9 the default codec for vpxenc

Change-Id: Ic3b4f3c9a6d8f9b04efb8b5ee080880895063564

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,5 @@
 xxxx-yy-zz v1.4.0 "Changes for next release"
+  vpxenc is changed to use VP9 by default.
   Encoder controls added for 1 pass SVC.
 
 2015-04-03 v1.4.0 "Indian Runner Duck"
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -469,6 +469,7 @@
 
 void usage_exit(void) {
   int i;
+  const int num_encoder = get_vpx_encoder_count();
 
   fprintf(stderr, "Usage: %s <options> -o dst_filename src_filename \n",
           exec_name);
@@ -496,11 +497,15 @@
           "  in fractional seconds. Default is 1/1000.\n");
   fprintf(stderr, "\nIncluded encoders:\n\n");
 
-  for (i = 0; i < get_vpx_encoder_count(); ++i) {
+  for (i = 0; i < num_encoder; ++i) {
     const VpxInterface *const encoder = get_vpx_encoder_by_index(i);
-    fprintf(stderr, "    %-6s - %s\n",
-            encoder->name, vpx_codec_iface_name(encoder->codec_interface()));
+    const char* defstr = (i == (num_encoder - 1)) ? "(default)" : "";
+      fprintf(stderr, "    %-6s - %s %s\n",
+              encoder->name, vpx_codec_iface_name(encoder->codec_interface()),
+              defstr);
   }
+  fprintf(stderr, "\n        ");
+  fprintf(stderr, "Use --codec to switch to a non-default encoder.\n\n");
 
   exit(EXIT_FAILURE);
 }
@@ -811,10 +816,14 @@
 static void parse_global_config(struct VpxEncoderConfig *global, char **argv) {
   char       **argi, **argj;
   struct arg   arg;
+  const int num_encoder = get_vpx_encoder_count();
 
+  if (num_encoder < 1)
+    die("Error: no valid encoder available\n");
+
   /* Initialize default parameters */
   memset(global, 0, sizeof(*global));
-  global->codec = get_vpx_encoder_by_index(0);
+  global->codec = get_vpx_encoder_by_index(num_encoder - 1);
   global->passes = 0;
   global->color_type = I420;
   /* Assign default deadline to good quality */