diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-02-01 17:04:52 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-02-01 17:35:54 +0100 |
commit | b28ae1e09bd3ee3942fa986a674acee7fca899e8 (patch) | |
tree | fbd632e89344eece37a5177c1788535e38d565a8 | |
parent | e26e6240b6700c5e8c16d0f092f1ad46805a723c (diff) | |
download | ffmpeg-b28ae1e09bd3ee3942fa986a674acee7fca899e8.tar.gz |
avcodec/ituh263dec: Implement B frame support with UMV
Fixes: u263_b-frames_1.avi
Fixes part of Ticket1536
return -1 is used here as it is used in similar code in this function, I intend
to replace it by proper error codes in the whole function.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/ituh263dec.c | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 5e3c0eac07..b36557604b 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -771,11 +771,25 @@ int ff_h263_decode_mb(MpegEncContext *s, //FIXME UMV if(USES_LIST(mb_type, 0)){ - int16_t *mot_val= ff_h263_pred_motion(s, 0, 0, &mx, &my); + int16_t *mot_val= ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); s->mv_dir = MV_DIR_FORWARD; - mx = ff_h263_decode_motion(s, mx, 1); - my = ff_h263_decode_motion(s, my, 1); + if (s->umvplus) + mx = h263p_decode_umotion(s, pred_x); + else + mx = ff_h263_decode_motion(s, pred_x, 1); + if (mx >= 0xffff) + return -1; + + if (s->umvplus) + my = h263p_decode_umotion(s, pred_y); + else + my = ff_h263_decode_motion(s, pred_y, 1); + if (my >= 0xffff) + return -1; + + if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) + skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */ s->mv[0][0][0] = mx; s->mv[0][0][1] = my; @@ -784,11 +798,25 @@ int ff_h263_decode_mb(MpegEncContext *s, } if(USES_LIST(mb_type, 1)){ - int16_t *mot_val= ff_h263_pred_motion(s, 0, 1, &mx, &my); + int16_t *mot_val= ff_h263_pred_motion(s, 0, 1, &pred_x, &pred_y); s->mv_dir |= MV_DIR_BACKWARD; - mx = ff_h263_decode_motion(s, mx, 1); - my = ff_h263_decode_motion(s, my, 1); + if (s->umvplus) + mx = h263p_decode_umotion(s, pred_x); + else + mx = ff_h263_decode_motion(s, pred_x, 1); + if (mx >= 0xffff) + return -1; + + if (s->umvplus) + my = h263p_decode_umotion(s, pred_y); + else + my = ff_h263_decode_motion(s, pred_y, 1); + if (my >= 0xffff) + return -1; + + if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) + skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */ s->mv[1][0][0] = mx; s->mv[1][0][1] = my; @@ -1081,6 +1109,12 @@ int ff_h263_decode_picture_header(MpegEncContext *s) av_log(s->avctx, AV_LOG_ERROR, "unordered slices not supported\n"); } } + if (s->pict_type == AV_PICTURE_TYPE_B) { + skip_bits(&s->gb, 4); //ELNUM + if (ufep == 1) { + skip_bits(&s->gb, 4); // RLNUM + } + } } s->qscale = get_bits(&s->gb, 5); @@ -1133,6 +1167,9 @@ int ff_h263_decode_picture_header(MpegEncContext *s) } s->f_code = 1; + if (s->pict_type == AV_PICTURE_TYPE_B) + s->low_delay = 0; + if(s->h263_aic){ s->y_dc_scale_table= s->c_dc_scale_table= ff_aic_dc_scale_table; |