shithub: opus-tools

Download patch

ref: 679382ed05057bd64dafa7776a37dc5be05e57ce
parent: adbe1b191c43436868381668f72d7f6513711fdc
author: Gregory Maxwell <greg@xiph.org>
date: Wed Jul 25 08:28:51 EDT 2012

Add a notice when complexity<10 is requested with resampling.

--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -183,6 +183,7 @@
     {"vbr",no_argument,NULL, 0},
     {"cvbr",no_argument,NULL, 0},
     {"comp", required_argument, NULL, 0},
+    {"complexity", required_argument, NULL, 0},
     {"framesize", required_argument, NULL, 0},
     {"expect-loss", required_argument, NULL, 0},
     {"downmix-mono",no_argument,NULL, 0},
@@ -371,7 +372,8 @@
             fprintf(stderr,"Expected loss is a percent and must be 0-100.\n");
             exit(1);
           }
-        }else if(strcmp(long_options[option_index].name,"comp")==0){
+        }else if(strcmp(long_options[option_index].name,"comp")==0 ||
+                 strcmp(long_options[option_index].name,"complexity")==0){
           complexity=atoi(optarg);
           if(complexity>10||complexity<0){
             fprintf(stderr,"Invalid complexity: %s\n",optarg);
@@ -518,7 +520,12 @@
 
   /*Scale the resampler complexity, but only for 48000 output because
     the near-cutoff behavior matters a lot more at lower rates.*/
-  if(rate!=coding_rate)setup_resample(&inopt,coding_rate==48000?complexity/2:5,coding_rate);
+  if(rate!=coding_rate)setup_resample(&inopt,coding_rate==48000?(complexity+1)/2:5,coding_rate);
+
+  if(rate!=coding_rate&&complexity!=10&&!quiet){
+    fprintf(stderr,"Notice: Using resampling with complexity<10.\n");
+    fprintf(stderr,"Opusenc is fastest with 48, 24, 16, 12, or 8kHz input.\n\n");
+  }
 
   /*OggOpus headers*/ /*FIXME: broke forcemono*/
   header.channels=chan;