Mercurial > libavcodec.hg
changeset 1701:95b7ac3344df libavcodec
rv20 / h263 b frame fix
author | michael |
---|---|
date | Sun, 21 Dec 2003 20:06:59 +0000 |
parents | 651b422d51d8 |
children | fbab59f03144 |
files | h263.c h263data.h rv10.c |
diffstat | 3 files changed, 36 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/h263.c Fri Dec 19 00:47:36 2003 +0000 +++ b/h263.c Sun Dec 21 20:06:59 2003 +0000 @@ -1548,9 +1548,9 @@ static const int off[4]= {2, 1, 1, -1}; wrap = s->b8_stride; - xy = s->mb_x + s->mb_y * wrap; - - mot_val = s->current_picture.motion_val[0][dir] + xy; + xy = 2*(s->mb_x + s->mb_y * wrap); + + mot_val = s->current_picture.motion_val[dir] + xy; A = mot_val[ - 1]; /* special case for first (slice) line */ @@ -3815,15 +3815,15 @@ } else if(s->pict_type==B_TYPE) { int mb_type; const int stride= s->b8_stride; - int16_t *mot_val0 = s->current_picture.motion_val[0][ s->mb_x + s->mb_y*stride ]; - int16_t *mot_val1 = s->current_picture.motion_val[1][ s->mb_x + s->mb_y*stride ]; + int16_t *mot_val0 = s->current_picture.motion_val[0][ 2*(s->mb_x + s->mb_y*stride) ]; + int16_t *mot_val1 = s->current_picture.motion_val[1][ 2*(s->mb_x + s->mb_y*stride) ]; // const int mv_xy= s->mb_x + 1 + s->mb_y * s->mb_stride; //FIXME ugly - mot_val0[0 ]= mot_val0[2 ]= mot_val0[0+stride]= mot_val0[2+stride]= 0; - mot_val0[1 ]= mot_val0[3 ]= mot_val0[1+stride]= mot_val0[3+stride]= 0; - mot_val1[0 ]= mot_val1[2 ]= mot_val1[0+stride]= mot_val1[2+stride]= 0; - mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+stride]= mot_val1[3+stride]= 0; + mot_val0[0 ]= mot_val0[2 ]= mot_val0[0+2*stride]= mot_val0[2+2*stride]= + mot_val0[1 ]= mot_val0[3 ]= mot_val0[1+2*stride]= mot_val0[3+2*stride]= + mot_val1[0 ]= mot_val1[2 ]= mot_val1[0+2*stride]= mot_val1[2+2*stride]= + mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+2*stride]= mot_val1[3+2*stride]= 0; do{ mb_type= get_vlc2(&s->gb, h263_mbtype_b_vlc.table, H263_MBTYPE_B_VLC_BITS, 2); @@ -3877,22 +3877,24 @@ mx = h263_decode_motion(s, mx, 1); my = h263_decode_motion(s, my, 1); + s->mv[0][0][0] = mx; s->mv[0][0][1] = my; - mot_val[0 ]= mot_val[2 ]= mot_val[0+stride]= mot_val[2+stride]= mx; - mot_val[1 ]= mot_val[3 ]= mot_val[1+stride]= mot_val[3+stride]= my; + mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx; + mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; } if(USES_LIST(mb_type, 1)){ int16_t *mot_val= h263_pred_motion2(s, 0, 1, &mx, &my); s->mv_dir |= MV_DIR_BACKWARD; - + mx = h263_decode_motion(s, mx, 1); my = h263_decode_motion(s, my, 1); + s->mv[1][0][0] = mx; s->mv[1][0][1] = my; - mot_val[0 ]= mot_val[2 ]= mot_val[0+stride]= mot_val[2+stride]= mx; - mot_val[1 ]= mot_val[3 ]= mot_val[1+stride]= mot_val[3+stride]= my; + mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx; + mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; } }
--- a/h263data.h Fri Dec 19 00:47:36 2003 +0000 +++ b/h263data.h Sun Dec 21 20:06:59 2003 +0000 @@ -51,15 +51,15 @@ MB_TYPE_DIRECT2 | MB_TYPE_L0L1, MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP, MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT, - MB_TYPE_L0, - MB_TYPE_L0 | MB_TYPE_CBP, - MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_QUANT, - MB_TYPE_L1, - MB_TYPE_L1 | MB_TYPE_CBP, - MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_QUANT, - MB_TYPE_L0L1, - MB_TYPE_L0L1 | MB_TYPE_CBP, - MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT, + MB_TYPE_L0 | MB_TYPE_16x16, + MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_16x16, + MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, + MB_TYPE_L1 | MB_TYPE_16x16, + MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_16x16, + MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, + MB_TYPE_L0L1 | MB_TYPE_16x16, + MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_16x16, + MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, 0, //stuffing MB_TYPE_INTRA | MB_TYPE_CBP, MB_TYPE_INTRA | MB_TYPE_CBP | MB_TYPE_QUANT,
--- a/rv10.c Fri Dec 19 00:47:36 2003 +0000 +++ b/rv10.c Sun Dec 21 20:06:59 2003 +0000 @@ -378,12 +378,17 @@ if(s->avctx->has_b_frames){ if (get_bits(&s->gb, 1)){ - av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n"); +// av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n"); // return -1; } seq= get_bits(&s->gb, 15); - }else + mb_pos= get_bits(&s->gb, av_log2(s->mb_num-1)+1); + s->mb_x= mb_pos % s->mb_width; + s->mb_y= mb_pos / s->mb_width; + }else{ seq= get_bits(&s->gb, 8)*128; + mb_pos= ff_h263_decode_mba(s); + } //printf("%d\n", seq); seq |= s->time &~0x7FFF; if(seq - s->time > 0x4000) seq -= 0x8000; @@ -404,7 +409,6 @@ } // printf("%d %d %d %d %d\n", seq, (int)s->time, (int)s->last_non_b_time, s->pp_time, s->pb_time); - mb_pos= ff_h263_decode_mba(s); s->no_rounding= get_bits1(&s->gb); s->f_code = 1; @@ -648,6 +652,10 @@ if( rv10_decode_packet(avctx, buf, buf_size) < 0 ) return -1; } + + if(s->pict_type == B_TYPE){ //FIXME remove after cleaning mottion_val indexing + memset(s->current_picture.motion_val[0], 0, sizeof(int16_t)*2*(s->mb_width*2+2)*(s->mb_height*2+2)); + } if(s->mb_y>=s->mb_height){ MPV_frame_end(s);