changeset 2376:ed9bb4a45afa libavcodec

next try at fixing rv20 decoding
author michael
date Sun, 05 Dec 2004 23:21:39 +0000
parents 24d3a50d1b8b
children 9214c91cdfb7
files rv10.c
diffstat 1 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/rv10.c	Tue Nov 30 21:50:16 2004 +0000
+++ b/rv10.c	Sun Dec 05 23:21:39 2004 +0000
@@ -350,6 +350,13 @@
     }
     av_log(s->avctx, AV_LOG_DEBUG, "\n");
 #endif
+#if 0
+    for(i=0; i<s->avctx->extradata_size; i++){
+        av_log(s->avctx, AV_LOG_DEBUG, "%2X ", ((uint8_t*)s->avctx->extradata)[i]);
+        if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
+    }
+    av_log(s->avctx, AV_LOG_DEBUG, "\n");
+#endif
     
     if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002){
         if (get_bits(&s->gb, 3)){
@@ -396,18 +403,21 @@
 //            av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n");
 //            return -1;
         }
-        seq= get_bits(&s->gb, 15);
-        if (s->avctx->sub_id == 0x20201002 && 0 && get_bits(&s->gb, 1)){
-            av_log(s->avctx, AV_LOG_ERROR, "unknown bit4 set\n");
-//            return -1;
+        seq= get_bits(&s->gb, 14)<<1;
+        
+        if(s->avctx->extradata_size >= 4 && ((uint8_t*)s->avctx->extradata)[1]&1){
+            get_bits(&s->gb, 1);
+        }
+        if(s->avctx->extradata_size >= 4 && ((uint8_t*)s->avctx->extradata)[1]&2){
+            get_bits(&s->gb, 1);
         }
-        if(s->avctx->sub_id == 0x20201002){
-            mb_pos= ff_h263_decode_mba(s);
-        }else{
-            mb_pos= get_bits(&s->gb, av_log2(s->mb_num-1)+1);
-            s->mb_x= mb_pos % s->mb_width;
-            s->mb_y= mb_pos / s->mb_width;
+        if(s->avctx->extradata_size >= 4 && ((uint8_t*)s->avctx->extradata)[1]&4){
+            get_bits(&s->gb, 2);
         }
+
+        mb_pos= get_bits(&s->gb, av_log2(s->mb_num-1)+1);
+        s->mb_x= mb_pos % s->mb_width;
+        s->mb_y= mb_pos / s->mb_width;
     }else{
         seq= get_bits(&s->gb, 8)*128;
         mb_pos= ff_h263_decode_mba(s);
@@ -508,7 +518,11 @@
     default:
         av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
     }
-//av_log(avctx, AV_LOG_DEBUG, "ver:%X\n", avctx->sub_id);
+    
+    if(avctx->debug & FF_DEBUG_PICT_INFO){
+        av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", avctx->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1);
+    }
+    
     if (MPV_common_init(s) < 0)
         return -1;