[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec truemotion2.c,1.2,1.3

Mike Melanson CVS melanson
Sat Oct 15 16:33:14 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv723/libavcodec

Modified Files:
	truemotion2.c 
Log Message:
TM2 fixes by Kostya


Index: truemotion2.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/truemotion2.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- truemotion2.c	14 Oct 2005 16:17:40 -0000	1.2
+++ truemotion2.c	15 Oct 2005 14:33:11 -0000	1.3
@@ -29,7 +29,7 @@
 #include "dsputil.h"
 
 #define TM2_ESCAPE 0x80000000
-#define TM2_DELTAS 32
+#define TM2_DELTAS 64
 /* Huffman-coded streams of different types of blocks */
 enum TM2_STREAMS{ TM2_C_HI = 0, TM2_C_LO, TM2_L_HI, TM2_L_LO,
      TM2_UPD, TM2_MOT, TM2_TYPE, TM2_NUM_STREAMS};
@@ -218,7 +218,7 @@
         length = LE_32(buf);
         buf += 4;
         
-        init_get_bits(&ctx->gb, buf, 32);
+        init_get_bits(&ctx->gb, buf, 32 * 8);
         size = get_bits_long(&ctx->gb, 31);
         h = get_bits(&ctx->gb, 15);
         w = get_bits(&ctx->gb, 15);
@@ -281,7 +281,7 @@
             len = BE_32(buf); buf += 4; cur += 4;
         }
         if(len > 0) {
-            init_get_bits(&ctx->gb, buf, skip - cur);
+            init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
             if(tm2_read_deltas(ctx, stream_id) == -1)
                 return -1;
             buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
@@ -295,7 +295,7 @@
     buf += 4; cur += 4;
     buf += 4; cur += 4; /* unused by decoder */
     
-    init_get_bits(&ctx->gb, buf, skip - cur);
+    init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
     if(tm2_build_huff_table(ctx, &codes) == -1)
         return -1;
     buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
@@ -312,11 +312,12 @@
     ctx->tok_lens[stream_id] = toks;
     len = BE_32(buf); buf += 4; cur += 4;
     if(len > 0) {
-        init_get_bits(&ctx->gb, buf, skip - cur);
+        init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
         for(i = 0; i < toks; i++)
             ctx->tokens[stream_id][i] = tm2_get_token(&ctx->gb, &codes);
     } else {
-        memset(ctx->tokens[stream_id], 0, toks * sizeof(int));
+        for(i = 0; i < toks; i++)
+            ctx->tokens[stream_id][i] = codes.recode[0];
     }
     tm2_free_codes(&codes);
     
@@ -765,7 +766,8 @@
     int skip, t;
 
     p->reference = 1;
-    if(avctx->get_buffer(avctx, p) < 0){
+    p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
+    if(avctx->reget_buffer(avctx, p) < 0){
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return -1;
     }





More information about the ffmpeg-cvslog mailing list