summaryrefslogtreecommitdiff
path: root/libavcodec/h261dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-26 00:39:46 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-26 01:12:03 +0100
commit4090d5baa89467e4ebdc7747e795bd6d83a91635 (patch)
treec4a324fd17a3f1e86cb902df853afa4b6cdcedb4 /libavcodec/h261dec.c
parent8f20e3d4dfe5d54e36113e679bd1350e4550bc4d (diff)
avcodec/h261dec: fix motion vector vissualization
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h261dec.c')
-rw-r--r--libavcodec/h261dec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 696a0f2d00..882bef1947 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -341,7 +341,8 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
static int h261_decode_mb(H261Context *h)
{
MpegEncContext *const s = &h->s;
- int i, cbp, xy;
+ int i, cbp, xy, b_xy;
+ int b_stride = 2*s->mb_width + 1;
cbp = 63;
// Read mba
@@ -374,6 +375,7 @@ static int h261_decode_mb(H261Context *h)
s->mb_x = ((h->gob_number - 1) % 2) * 11 + ((h->current_mba - 1) % 11);
s->mb_y = ((h->gob_number - 1) / 2) * 3 + ((h->current_mba - 1) / 11);
xy = s->mb_x + s->mb_y * s->mb_stride;
+ b_xy = 2 * s->mb_x + (2 * s->mb_y) * b_stride;
ff_init_block_index(s);
ff_update_block_index(s);
@@ -432,6 +434,11 @@ static int h261_decode_mb(H261Context *h)
s->mv[0][0][0] = h->current_mv_x * 2; // gets divided by 2 in motion compensation
s->mv[0][0][1] = h->current_mv_y * 2;
+ if (s->current_picture.motion_val[0]) {
+ s->current_picture.motion_val[0][b_xy][0] = s->mv[0][0][0];
+ s->current_picture.motion_val[0][b_xy][1] = s->mv[0][0][1];
+ }
+
intra:
/* decode each block */
if (s->mb_intra || HAS_CBP(h->mtype)) {