[vorbis-dev] rehuff -- maintenance release

Segher Boessenkool segher at chello.nl
Fri Aug 2 04:23:45 PDT 2002



Hi all,

There were a few "non-optimalities" in the rehuff code.  Please apply
patch, and cross fingers.

Special thanks to Alan MacDonald, who found the semicolon imperfection,
and everyone who sent me bug reports.

Please test again :)

The second problem is an evil one: a codeword length of zero is actually
quite fine if it's the only codeword in the codebook; but Vorbis takes
a length of zero to mean "not allocated".  So let's waste a bit on those
cases...

<p>Have fun,

<p>Segher

<p><p>diff -ur rehuff/recode-headers.c rehuff-new/recode-headers.c
--- rehuff/recode-headers.c	Wed Jul 31 02:09:23 2002
+++ rehuff-new/recode-headers.c	Fri Aug  2 10:11:41 2002
@@ -275,11 +275,11 @@
                 recode_residue(&ob_in, &ob_out, headers->residue + i);
 
         oggpack_copy(&ob_in, &ob_out, 6);
-	for (i = 0; i < headers->mappings; i++);
+	for (i = 0; i < headers->mappings; i++)
                 recode_mapping(&ob_in, &ob_out, headers->mapping + i, headers);
 
         oggpack_copy(&ob_in, &ob_out, 6);
-	for (i = 0; i < headers->modes; i++);
+	for (i = 0; i < headers->modes; i++)
                 recode_mode(&ob_in, &ob_out, headers->mode + i);
 
         oggpack_copy(&ob_in, &ob_out, 1);
diff -ur rehuff/recode.c rehuff-new/recode.c
--- rehuff/recode.c	Wed Jul 31 01:54:03 2002
+++ rehuff-new/recode.c	Fri Aug  2 12:55:24 2002
@@ -118,7 +118,7 @@
         if (heap.n) {
                 for (i = 0; i < 2*book->n-1; i++)
                         length[i] = -1;
-		length[heap.x[1]] = 0;
+		length[heap.x[1]] = (heap.x[1] < book->n ? 1 : 0);
         }
 
         book->new_length = malloc(book->n * sizeof(*book->new_length));



diff -ur rehuff/recode-headers.c rehuff-new/recode-headers.c
--- rehuff/recode-headers.c	Wed Jul 31 02:09:23 2002
+++ rehuff-new/recode-headers.c	Fri Aug  2 10:11:41 2002
@@ -275,11 +275,11 @@
                 recode_residue(&ob_in, &ob_out, headers->residue + i);
 
         oggpack_copy(&ob_in, &ob_out, 6);
-	for (i = 0; i < headers->mappings; i++);
+	for (i = 0; i < headers->mappings; i++)
                 recode_mapping(&ob_in, &ob_out, headers->mapping + i, headers);
 
         oggpack_copy(&ob_in, &ob_out, 6);
-	for (i = 0; i < headers->modes; i++);
+	for (i = 0; i < headers->modes; i++)
                 recode_mode(&ob_in, &ob_out, headers->mode + i);
 
         oggpack_copy(&ob_in, &ob_out, 1);
diff -ur rehuff/recode.c rehuff-new/recode.c
--- rehuff/recode.c	Wed Jul 31 01:54:03 2002
+++ rehuff-new/recode.c	Fri Aug  2 12:55:24 2002
@@ -118,7 +118,7 @@
         if (heap.n) {
                 for (i = 0; i < 2*book->n-1; i++)
                         length[i] = -1;
-		length[heap.x[1]] = 0;
+		length[heap.x[1]] = (heap.x[1] < book->n ? 1 : 0);
         }
 
         book->new_length = malloc(book->n * sizeof(*book->new_length));

<p><p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list