Mercurial > libavcodec.hg
comparison h263.c @ 1701:95b7ac3344df libavcodec
rv20 / h263 b frame fix
author | michael |
---|---|
date | Sun, 21 Dec 2003 20:06:59 +0000 |
parents | 6bd7a01eca9c |
children | dea5b2946999 |
comparison
equal
deleted
inserted
replaced
1700:651b422d51d8 | 1701:95b7ac3344df |
---|---|
1546 int xy, wrap; | 1546 int xy, wrap; |
1547 int16_t *A, *B, *C, (*mot_val)[2]; | 1547 int16_t *A, *B, *C, (*mot_val)[2]; |
1548 static const int off[4]= {2, 1, 1, -1}; | 1548 static const int off[4]= {2, 1, 1, -1}; |
1549 | 1549 |
1550 wrap = s->b8_stride; | 1550 wrap = s->b8_stride; |
1551 xy = s->mb_x + s->mb_y * wrap; | 1551 xy = 2*(s->mb_x + s->mb_y * wrap); |
1552 | 1552 |
1553 mot_val = s->current_picture.motion_val[0][dir] + xy; | 1553 mot_val = s->current_picture.motion_val[dir] + xy; |
1554 | 1554 |
1555 A = mot_val[ - 1]; | 1555 A = mot_val[ - 1]; |
1556 /* special case for first (slice) line */ | 1556 /* special case for first (slice) line */ |
1557 if (s->first_slice_line && block<3) { | 1557 if (s->first_slice_line && block<3) { |
1558 // we cant just change some MVs to simulate that as we need them for the B frames (and ME) | 1558 // we cant just change some MVs to simulate that as we need them for the B frames (and ME) |
3813 preview_obmc(s); | 3813 preview_obmc(s); |
3814 } | 3814 } |
3815 } else if(s->pict_type==B_TYPE) { | 3815 } else if(s->pict_type==B_TYPE) { |
3816 int mb_type; | 3816 int mb_type; |
3817 const int stride= s->b8_stride; | 3817 const int stride= s->b8_stride; |
3818 int16_t *mot_val0 = s->current_picture.motion_val[0][ s->mb_x + s->mb_y*stride ]; | 3818 int16_t *mot_val0 = s->current_picture.motion_val[0][ 2*(s->mb_x + s->mb_y*stride) ]; |
3819 int16_t *mot_val1 = s->current_picture.motion_val[1][ s->mb_x + s->mb_y*stride ]; | 3819 int16_t *mot_val1 = s->current_picture.motion_val[1][ 2*(s->mb_x + s->mb_y*stride) ]; |
3820 // const int mv_xy= s->mb_x + 1 + s->mb_y * s->mb_stride; | 3820 // const int mv_xy= s->mb_x + 1 + s->mb_y * s->mb_stride; |
3821 | 3821 |
3822 //FIXME ugly | 3822 //FIXME ugly |
3823 mot_val0[0 ]= mot_val0[2 ]= mot_val0[0+stride]= mot_val0[2+stride]= 0; | 3823 mot_val0[0 ]= mot_val0[2 ]= mot_val0[0+2*stride]= mot_val0[2+2*stride]= |
3824 mot_val0[1 ]= mot_val0[3 ]= mot_val0[1+stride]= mot_val0[3+stride]= 0; | 3824 mot_val0[1 ]= mot_val0[3 ]= mot_val0[1+2*stride]= mot_val0[3+2*stride]= |
3825 mot_val1[0 ]= mot_val1[2 ]= mot_val1[0+stride]= mot_val1[2+stride]= 0; | 3825 mot_val1[0 ]= mot_val1[2 ]= mot_val1[0+2*stride]= mot_val1[2+2*stride]= |
3826 mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+stride]= mot_val1[3+stride]= 0; | 3826 mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+2*stride]= mot_val1[3+2*stride]= 0; |
3827 | 3827 |
3828 do{ | 3828 do{ |
3829 mb_type= get_vlc2(&s->gb, h263_mbtype_b_vlc.table, H263_MBTYPE_B_VLC_BITS, 2); | 3829 mb_type= get_vlc2(&s->gb, h263_mbtype_b_vlc.table, H263_MBTYPE_B_VLC_BITS, 2); |
3830 if (mb_type < 0){ | 3830 if (mb_type < 0){ |
3831 av_log(s->avctx, AV_LOG_ERROR, "b mb_type damaged at %d %d\n", s->mb_x, s->mb_y); | 3831 av_log(s->avctx, AV_LOG_ERROR, "b mb_type damaged at %d %d\n", s->mb_x, s->mb_y); |
3875 int16_t *mot_val= h263_pred_motion2(s, 0, 0, &mx, &my); | 3875 int16_t *mot_val= h263_pred_motion2(s, 0, 0, &mx, &my); |
3876 s->mv_dir = MV_DIR_FORWARD; | 3876 s->mv_dir = MV_DIR_FORWARD; |
3877 | 3877 |
3878 mx = h263_decode_motion(s, mx, 1); | 3878 mx = h263_decode_motion(s, mx, 1); |
3879 my = h263_decode_motion(s, my, 1); | 3879 my = h263_decode_motion(s, my, 1); |
3880 | |
3880 s->mv[0][0][0] = mx; | 3881 s->mv[0][0][0] = mx; |
3881 s->mv[0][0][1] = my; | 3882 s->mv[0][0][1] = my; |
3882 mot_val[0 ]= mot_val[2 ]= mot_val[0+stride]= mot_val[2+stride]= mx; | 3883 mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx; |
3883 mot_val[1 ]= mot_val[3 ]= mot_val[1+stride]= mot_val[3+stride]= my; | 3884 mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; |
3884 } | 3885 } |
3885 | 3886 |
3886 if(USES_LIST(mb_type, 1)){ | 3887 if(USES_LIST(mb_type, 1)){ |
3887 int16_t *mot_val= h263_pred_motion2(s, 0, 1, &mx, &my); | 3888 int16_t *mot_val= h263_pred_motion2(s, 0, 1, &mx, &my); |
3888 s->mv_dir |= MV_DIR_BACKWARD; | 3889 s->mv_dir |= MV_DIR_BACKWARD; |
3889 | 3890 |
3890 mx = h263_decode_motion(s, mx, 1); | 3891 mx = h263_decode_motion(s, mx, 1); |
3891 my = h263_decode_motion(s, my, 1); | 3892 my = h263_decode_motion(s, my, 1); |
3893 | |
3892 s->mv[1][0][0] = mx; | 3894 s->mv[1][0][0] = mx; |
3893 s->mv[1][0][1] = my; | 3895 s->mv[1][0][1] = my; |
3894 mot_val[0 ]= mot_val[2 ]= mot_val[0+stride]= mot_val[2+stride]= mx; | 3896 mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx; |
3895 mot_val[1 ]= mot_val[3 ]= mot_val[1+stride]= mot_val[3+stride]= my; | 3897 mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; |
3896 } | 3898 } |
3897 } | 3899 } |
3898 | 3900 |
3899 s->current_picture.mb_type[xy]= mb_type; | 3901 s->current_picture.mb_type[xy]= mb_type; |
3900 } else { /* I-Frame */ | 3902 } else { /* I-Frame */ |