[xiph-commits] r15934 - in branches/theora-thusnelda: doc/spec examples lib/enc

gmaxwell at svn.xiph.org gmaxwell at svn.xiph.org
Mon Apr 13 16:15:15 PDT 2009


Author: gmaxwell
Date: 2009-04-13 16:15:14 -0700 (Mon, 13 Apr 2009)
New Revision: 15934

Modified:
   branches/theora-thusnelda/doc/spec/spec.tex
   branches/theora-thusnelda/examples/encoder_example.c
   branches/theora-thusnelda/examples/png2theora.c
   branches/theora-thusnelda/lib/enc/encoder_toplevel.c
Log:
Remove 16mbit/sec cap for rate management; update the spec to reflect the clamping of NOMBR. I'm not particularity enamored with any specific way of handling this, I just want the cap gone.

Modified: branches/theora-thusnelda/doc/spec/spec.tex
===================================================================
--- branches/theora-thusnelda/doc/spec/spec.tex	2009-04-10 02:10:55 UTC (rev 15933)
+++ branches/theora-thusnelda/doc/spec/spec.tex	2009-04-13 23:15:14 UTC (rev 15934)
@@ -2211,12 +2211,13 @@
 \label{tab:colorspaces}
 \end{table}
 \item
-Read a 24-bit unsigned integer as \bitvar{NOMBR}.
+Read a 24-bit unsigned integer as \bitvar{NOMBR} signifying a rate in bits
+per second. Rates equal to or greater than $2^{24}-1$ bits per second are
+represented as $2^{24}-1$. 
 The \bitvar{NOMBR} field is used only as a hint.
 For pure VBR streams, this value may be considerably off.
 The field MAY be set to zero to indicate that the encoder did not care to
- speculate.
- %TODO: units?
+speculate. 
 \item
 Read a 6-bit unsigned integer as \bitvar{QUAL}.
 This value is used to provide a hint as to the relative quality of the stream

Modified: branches/theora-thusnelda/examples/encoder_example.c
===================================================================
--- branches/theora-thusnelda/examples/encoder_example.c	2009-04-10 02:10:55 UTC (rev 15933)
+++ branches/theora-thusnelda/examples/encoder_example.c	2009-04-13 23:15:14 UTC (rev 15934)
@@ -1192,13 +1192,10 @@
 
     case 'V':
       video_r=(int)rint(atof(optarg)*1000);
-      if(video_r<0){
+      if(video_r<1){
         fprintf(stderr,"Illegal video bitrate (choose > 0 please)\n");
         exit(1);
       }
-      if(video_r>(1<<24)-1){
-        fprintf(stderr,"Warning: encoder may limit video to 16 Mbps\n");
-      }
       video_q=0;
      break;
 

Modified: branches/theora-thusnelda/examples/png2theora.c
===================================================================
--- branches/theora-thusnelda/examples/png2theora.c	2009-04-10 02:10:55 UTC (rev 15933)
+++ branches/theora-thusnelda/examples/png2theora.c	2009-04-13 23:15:14 UTC (rev 15934)
@@ -462,8 +462,8 @@
         break;
       case 'V':
         video_rate=rint(atof(optarg)*1000);
-        if(video_rate<45000 || video_rate>2000000){
-          fprintf(stderr,"Illegal video bitrate (choose 45kbps through 2000kbps)\n");
+        if(video_rate<1){
+          fprintf(stderr,"Illegal video bitrate (choose > 0 please)\n");
           exit(1);
         }
         video_quality=0;

Modified: branches/theora-thusnelda/lib/enc/encoder_toplevel.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_toplevel.c	2009-04-10 02:10:55 UTC (rev 15933)
+++ branches/theora-thusnelda/lib/enc/encoder_toplevel.c	2009-04-13 23:15:14 UTC (rev 15934)
@@ -374,9 +374,6 @@
     c->keyframe_mindistance=c->keyframe_frequency_force;
   cpi->keyframe_granule_shift=OC_ILOG_32(c->keyframe_frequency_force-1);
 
-  /* clamp the target_bitrate to a maximum of 24 bits so we get a
-     more meaningful value when we write this out in the header. */
-  if(c->target_bitrate>(1<<24)-1)c->target_bitrate=(1<<24)-1;
 
   /* copy in config */
   memcpy(&cpi->info,c,sizeof(*c));
@@ -590,7 +587,10 @@
   oggpackB_write(cpi->oggbuffer,cpi->info.aspect_denominator,24);
 
   oggpackB_write(cpi->oggbuffer,cpi->info.colorspace,8);
-  oggpackB_write(cpi->oggbuffer,cpi->info.target_bitrate,24);
+
+  /* The header target_bitrate is limited to 24 bits, so we clamp here */
+  oggpackB_write(cpi->oggbuffer,(cpi->info.target_bitrate>(1<<24)-1) ? ((1<<24)-1) : cpi->info.target_bitrate ,24);
+
   oggpackB_write(cpi->oggbuffer,cpi->info.quality,6);
 
   oggpackB_write(cpi->oggbuffer,cpi->keyframe_granule_shift,5);



More information about the commits mailing list