Mercurial > libavcodec.hg
comparison msmpeg4.c @ 1938:e2501e6e7ff7 libavcodec
unify table indexing (motion_val,dc_val,ac_val,coded_block changed)
minor +-1 bugfix
author | michael |
---|---|
date | Fri, 16 Apr 2004 01:01:45 +0000 |
parents | 07a484280a82 |
children | 4225c131a2eb |
comparison
equal
deleted
inserted
replaced
1937:4d91a9342d95 | 1938:e2501e6e7ff7 |
---|---|
447 static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr) | 447 static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr) |
448 { | 448 { |
449 int xy, wrap, pred, a, b, c; | 449 int xy, wrap, pred, a, b, c; |
450 | 450 |
451 xy = s->block_index[n]; | 451 xy = s->block_index[n]; |
452 wrap = s->block_wrap[0]; | 452 wrap = s->b8_stride; |
453 | 453 |
454 /* B C | 454 /* B C |
455 * A X | 455 * A X |
456 */ | 456 */ |
457 a = s->coded_block[xy - 1 ]; | 457 a = s->coded_block[xy - 1 ]; |
565 cbpy_tab[coded_cbp>>2][1], | 565 cbpy_tab[coded_cbp>>2][1], |
566 cbpy_tab[coded_cbp>>2][0]); | 566 cbpy_tab[coded_cbp>>2][0]); |
567 | 567 |
568 s->misc_bits += get_bits_diff(s); | 568 s->misc_bits += get_bits_diff(s); |
569 | 569 |
570 h263_pred_motion(s, 0, &pred_x, &pred_y); | 570 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
571 msmpeg4v2_encode_motion(s, motion_x - pred_x); | 571 msmpeg4v2_encode_motion(s, motion_x - pred_x); |
572 msmpeg4v2_encode_motion(s, motion_y - pred_y); | 572 msmpeg4v2_encode_motion(s, motion_y - pred_y); |
573 }else{ | 573 }else{ |
574 put_bits(&s->pb, | 574 put_bits(&s->pb, |
575 table_mb_non_intra[cbp + 64][1], | 575 table_mb_non_intra[cbp + 64][1], |
576 table_mb_non_intra[cbp + 64][0]); | 576 table_mb_non_intra[cbp + 64][0]); |
577 | 577 |
578 s->misc_bits += get_bits_diff(s); | 578 s->misc_bits += get_bits_diff(s); |
579 | 579 |
580 /* motion vector */ | 580 /* motion vector */ |
581 h263_pred_motion(s, 0, &pred_x, &pred_y); | 581 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
582 msmpeg4_encode_motion(s, motion_x - pred_x, | 582 msmpeg4_encode_motion(s, motion_x - pred_x, |
583 motion_y - pred_y); | 583 motion_y - pred_y); |
584 } | 584 } |
585 | 585 |
586 s->mv_bits += get_bits_diff(s); | 586 s->mv_bits += get_bits_diff(s); |
1547 } | 1547 } |
1548 | 1548 |
1549 cbp|= cbpy<<2; | 1549 cbp|= cbpy<<2; |
1550 if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C; | 1550 if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C; |
1551 | 1551 |
1552 h263_pred_motion(s, 0, &mx, &my); | 1552 h263_pred_motion(s, 0, 0, &mx, &my); |
1553 mx= msmpeg4v2_decode_motion(s, mx, 1); | 1553 mx= msmpeg4v2_decode_motion(s, mx, 1); |
1554 my= msmpeg4v2_decode_motion(s, my, 1); | 1554 my= msmpeg4v2_decode_motion(s, my, 1); |
1555 | 1555 |
1556 s->mv_dir = MV_DIR_FORWARD; | 1556 s->mv_dir = MV_DIR_FORWARD; |
1557 s->mv_type = MV_TYPE_16X16; | 1557 s->mv_type = MV_TYPE_16X16; |
1635 if(s->per_mb_rl_table && cbp){ | 1635 if(s->per_mb_rl_table && cbp){ |
1636 s->rl_table_index = decode012(&s->gb); | 1636 s->rl_table_index = decode012(&s->gb); |
1637 s->rl_chroma_table_index = s->rl_table_index; | 1637 s->rl_chroma_table_index = s->rl_table_index; |
1638 } | 1638 } |
1639 set_stat(ST_MV); | 1639 set_stat(ST_MV); |
1640 h263_pred_motion(s, 0, &mx, &my); | 1640 h263_pred_motion(s, 0, 0, &mx, &my); |
1641 if (msmpeg4_decode_motion(s, &mx, &my) < 0) | 1641 if (msmpeg4_decode_motion(s, &mx, &my) < 0) |
1642 return -1; | 1642 return -1; |
1643 s->mv_dir = MV_DIR_FORWARD; | 1643 s->mv_dir = MV_DIR_FORWARD; |
1644 s->mv_type = MV_TYPE_16X16; | 1644 s->mv_type = MV_TYPE_16X16; |
1645 s->mv[0][0][0] = mx; | 1645 s->mv[0][0][0] = mx; |