]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/lagarithrac.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / lagarithrac.c
index a3035a24d4a67ed45b71aee6090ff2409cc52d3f..895acb0d354bc6598003418d4b2b39f2f1766fc6 100644 (file)
 
 void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int length)
 {
-    int i, j;
+    int i, j, left;
 
     /* According to reference decoder "1st byte is garbage",
      * however, it gets skipped by the call to align_get_bits()
      */
     align_get_bits(gb);
+    left                = get_bits_left(gb) >> 3;
     l->bytestream_start =
     l->bytestream       = gb->buffer + get_bits_count(gb) / 8;
-    l->bytestream_end   = l->bytestream_start + length;
+    l->bytestream_end   = l->bytestream_start + left;
 
     l->range        = 0x80;
     l->low          = *l->bytestream >> 1;
-    l->hash_shift   = FFMAX(l->scale - 8, 0);
+    l->hash_shift   = FFMAX((int)l->scale - 8, 0);
 
     for (i = j = 0; i < 256; i++) {
         unsigned r = i << l->hash_shift;