]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/alac.c
Hardcode register to prevent aparent miscompilation.
[ffmpeg] / libavcodec / alac.c
index 257ad1c119ddd7f6f30f85930e5df47af09b4ac6..0689a46ef5c07d173af06d7ba4cd468750f329a4 100644 (file)
@@ -55,6 +55,7 @@
 #include "avcodec.h"
 #include "bitstream.h"
 #include "bytestream.h"
+#include "unary.h"
 
 #define ALAC_EXTRADATA_SIZE 36
 #define MAX_CHANNELS 2
@@ -106,7 +107,7 @@ static void allocate_buffers(ALACContext *alac)
 
 static int alac_set_info(ALACContext *alac)
 {
-    unsigned char *ptr = alac->avctx->extradata;
+    const unsigned char *ptr = alac->avctx->extradata;
 
     ptr += 4; /* size */
     ptr += 4; /* alac */
@@ -159,14 +160,12 @@ static void bastardized_rice_decompress(ALACContext *alac,
     int sign_modifier = 0;
 
     for (output_count = 0; output_count < output_size; output_count++) {
-        int32_t x = 0;
+        int32_t x;
         int32_t x_modified;
         int32_t final_val;
 
         /* read x - number of 1s before 0 represent the rice */
-        while (x <= 8 && get_bits1(&alac->gb)) {
-            x++;
-        }
+        x = get_unary_0_9(&alac->gb);
 
         if (x > 8) { /* RICE THRESHOLD */
             /* use alternative encoding */
@@ -227,10 +226,7 @@ static void bastardized_rice_decompress(ALACContext *alac,
 
             sign_modifier = 1;
 
-            x = 0;
-            while (x <= 8 && get_bits1(&alac->gb)) {
-                x++;
-            }
+            x = get_unary_0_9(&alac->gb);
 
             if (x > 8) {
                 block_size = get_bits(&alac->gb, 16);
@@ -329,15 +325,15 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
 
 #if 0
     /* 4 and 8 are very common cases (the only ones i've seen). these
-     * should be unrolled and optimised
+     * should be unrolled and optimized
      */
     if (predictor_coef_num == 4) {
-        /* FIXME: optimised general case */
+        /* FIXME: optimized general case */
         return;
     }
 
     if (predictor_coef_table == 8) {
-        /* FIXME: optimised general case */
+        /* FIXME: optimized general case */
         return;
     }
 #endif
@@ -443,7 +439,7 @@ static void reconstruct_stereo_16(int32_t *buffer[MAX_CHANNELS],
 
 static int alac_decode_frame(AVCodecContext *avctx,
                              void *outbuffer, int *outputsize,
-                             uint8_t *inbuffer, int input_buffer_size)
+                             const uint8_t *inbuffer, int input_buffer_size)
 {
     ALACContext *alac = avctx->priv_data;