shithub: opus

Download patch

ref: 4cc9a459e84d23bd9a96560e1e7397cd78dd38ab
parent: 9c937631215577e96e377b2c6aa6ad8f700efeda
author: Gregory Maxwell <[email protected]>
date: Mon Oct 3 09:07:17 EDT 2011

Eliminate redundant redundancy code.
The redundancy_bytes<0 test always fails because of the ec_tell(&dec)+29 test above.

--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -322,17 +322,8 @@
         if (redundancy)
         {
             celt_to_silk = ec_dec_bit_logp(&dec, 1);
-            if (mode == MODE_HYBRID)
-            	redundancy_bytes = 2 + ec_dec_uint(&dec, 256);
-            else {
-            	redundancy_bytes = len - ((ec_tell(&dec)+7)>>3);
-            	/* Can only happen on an invalid packet */
-            	if (redundancy_bytes<0)
-            	{
-            		redundancy_bytes = 0;
-            		redundancy = 0;
-            	}
-            }
+            /*Due to the ec_tell check above redundancy_bytes will be at least two for hybrid*/
+            redundancy_bytes = mode==MODE_HYBRID ? ec_dec_uint(&dec, 256)+2 : len-((ec_tell(&dec)+7)>>3);
             len -= redundancy_bytes;
             if (len<0)
             {