[FFmpeg-soc] [soc]: r3954 - dirac/libavcodec/dirac_arith.c

conrad subversion at mplayerhq.hu
Tue Jan 13 07:23:04 CET 2009


Author: conrad
Date: Tue Jan 13 07:23:04 2009
New Revision: 3954

Log:
Schroedinger's encoder relys on all overread bits being 1

Modified:
   dirac/libavcodec/dirac_arith.c

Modified: dirac/libavcodec/dirac_arith.c
==============================================================================
--- dirac/libavcodec/dirac_arith.c	Tue Jan 13 07:23:02 2009	(r3953)
+++ dirac/libavcodec/dirac_arith.c	Tue Jan 13 07:23:04 2009	(r3954)
@@ -158,12 +158,20 @@ static inline void renorm_arith_decoder(
         arith->low   <<= 1;
         arith->range <<= 1;
 
-        if (arith->bytestream < arith->bytestream_end && !--arith->counter) {
-            arith->low |= (arith->bytestream[0]<<8) + arith->bytestream[1];
-            arith->bytestream += 2;
+        if (!--arith->counter) {
+            if (arith->bytestream < arith->bytestream_end)
+                arith->low |= *arith->bytestream << 8;
+            else
+                arith->low |= 0xff00;
+            arith->bytestream++;
+
+            if (arith->bytestream < arith->bytestream_end)
+                arith->low |= *arith->bytestream;
+            else
+                arith->low |= 0xff;
+            arith->bytestream++;
+
             arith->counter = 16;
-        } else if (arith->bytestream >= arith->bytestream_end) {
-            arith->low |= 1;
         }
     }
 }



More information about the FFmpeg-soc mailing list