alac: adjust conditions for updating entropy decoder history
authorJustin Ruggles <justin.ruggles@gmail.com>
Mon, 9 Jul 2012 14:42:52 +0000 (10:42 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Thu, 19 Jul 2012 17:26:46 +0000 (13:26 -0400)
avoids some unnecessary arithmetic in certain situations

libavcodec/alac.c

index 84f7e42..f27992d 100644 (file)
@@ -131,11 +131,11 @@ static void bastardized_rice_decompress(ALACContext *alac,
         sign_modifier = 0;
 
         /* now update the history */
-        history += x_modified * rice_history_mult -
-                    ((history * rice_history_mult) >> 9);
-
         if (x_modified > 0xffff)
             history = 0xffff;
+        else
+            history += x_modified * rice_history_mult -
+                        ((history * rice_history_mult) >> 9);
 
         /* special case: there may be compressed blocks of 0 */
         if ((history < 128) && (output_count+1 < output_size)) {