]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
various fixes related to the non alt_bitstream_reader
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 18 Apr 2005 12:08:16 +0000 (12:08 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 18 Apr 2005 12:08:16 +0000 (12:08 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4136 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/bitstream.h
libavcodec/dv.c
libavcodec/svq3.c

index e6177ee98c9f84ce621987b40d2714e8a4480b2f..93e1e4fca2776e887568c902dcf6be496858a5e0 100644 (file)
@@ -429,7 +429,7 @@ static inline int get_bits_count(GetBitContext *s){
 #   define UPDATE_CACHE(name, gb)\
     if(name##_bit_count >= 0){\
         name##_cache+= (int)be2me_16(*(uint16_t*)name##_buffer_ptr) << name##_bit_count;\
-        ((uint16_t*)name##_buffer_ptr)++;\
+        name##_buffer_ptr += 2;\
         name##_bit_count-= 16;\
     }\
 
index 01e1ce6842b3edc74e2d53d08d94e5c4f0442ede..94440ed5cdf4661422a2cd3422010a05ee0c2746 100644 (file)
@@ -263,6 +263,7 @@ static const int mb_area_start[5] = { 1, 6, 21, 43, 64 };
 
 #ifndef ALT_BITSTREAM_READER
 #warning only works with ALT_BITSTREAM_READER
+static int re_index; //Hack to make it compile
 #endif
 
 static inline int get_bits_left(GetBitContext *s)
index 6c189b5e9d965529cc4ee01775cb873df96d12e3..547679bf1c5c84cd2275ebc53bc9330a44cedde8 100644 (file)
@@ -720,7 +720,7 @@ static int svq3_decode_slice_header (H264Context *h) {
   } else {
     int length = (header >> 5) & 3;
 
-    h->next_slice_index = s->gb.index + 8*show_bits (&s->gb, 8*length) + 8*length;
+    h->next_slice_index = get_bits_count(&s->gb) + 8*show_bits (&s->gb, 8*length) + 8*length;
 
     if (h->next_slice_index > s->gb.size_in_bits){
       av_log(h->s.avctx, AV_LOG_ERROR, "slice after bitstream end\n");
@@ -728,10 +728,10 @@ static int svq3_decode_slice_header (H264Context *h) {
     }
 
     s->gb.size_in_bits = h->next_slice_index - 8*(length - 1);
-    s->gb.index += 8;
+    skip_bits(&s->gb, 8);
 
     if (length > 0) {
-      memcpy ((uint8_t *) &s->gb.buffer[s->gb.index >> 3],
+      memcpy ((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3],
              &s->gb.buffer[s->gb.size_in_bits >> 3], (length - 1));
     }
   }
@@ -939,10 +939,10 @@ static int svq3_decode_frame (AVCodecContext *avctx,
   for (s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {
     for (s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
 
-      if ( (s->gb.index + 7) >= s->gb.size_in_bits &&
-         ((s->gb.index & 7) == 0 || show_bits (&s->gb, (-s->gb.index & 7)) == 0)) {
+      if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
+         ((get_bits_count(&s->gb) & 7) == 0 || show_bits (&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
 
-       s->gb.index = h->next_slice_index;
+       skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb));
        s->gb.size_in_bits = 8*buf_size;
 
        if (svq3_decode_slice_header (h))