Here's a patch that fixes decoding of Indeo 4 B-frames.

Now the main problem is Indeo 4 B-frames reconstruction. For that I
need to modify IVI context to store the second pair of vectors (that
is not hard at all) and make it perform the averaging motion
compensation for B-blocks (that one seems to require some more
hacking).
From 22b32375f8680540a73607269602f584e81182d1 Mon Sep 17 00:00:00 2001
From: Dirk Ausserhaus <[email protected]>
Date: Sun, 8 Jun 2014 13:44:17 +0200
Subject: [PATCH] indeo4: parse B-frame motion vectors correctly

---
 libavcodec/indeo4.c |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c
index 3e97221..0c93706 100644
--- a/libavcodec/indeo4.c
+++ b/libavcodec/indeo4.c
@@ -535,8 +535,25 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
                         mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table,
                                             IVI_VLC_BITS, 1);
                         mv_x += IVI_TOSIGNED(mv_delta);
-                        mb->mv_x = mv_x;
-                        mb->mv_y = mv_y;
+                        if (mb->type != 2) {
+                            mb->mv_x = mv_x;
+                            mb->mv_y = mv_y;
+                        } else {
+                            mb->mv_x = -mv_x;
+                            mb->mv_y = -mv_y;
+                        }
+                        if (mb->type == 3) {
+                            mv_delta = get_vlc2(&ctx->gb,
+                                                ctx->mb_vlc.tab->table,
+                                                IVI_VLC_BITS, 1);
+                            mv_y += IVI_TOSIGNED(mv_delta);
+                            mv_delta = get_vlc2(&ctx->gb,
+                                                ctx->mb_vlc.tab->table,
+                                                IVI_VLC_BITS, 1);
+                            mv_x += IVI_TOSIGNED(mv_delta);
+                            //mb->mv_x[1] = -mv_x;
+                            //mb->mv_y[1] = -mv_y;
+                        }
                     }
                 }
             }
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to