Mercurial > libavcodec.hg
comparison h263.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 | e5b0b33cf8aa |
children | a3f44c9168aa |
comparison
equal
deleted
inserted
replaced
1937:4d91a9342d95 | 1938:e2501e6e7ff7 |
---|---|
608 } | 608 } |
609 | 609 |
610 void ff_h263_update_motion_val(MpegEncContext * s){ | 610 void ff_h263_update_motion_val(MpegEncContext * s){ |
611 const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; | 611 const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; |
612 //FIXME a lot of thet is only needed for !low_delay | 612 //FIXME a lot of thet is only needed for !low_delay |
613 const int wrap = s->block_wrap[0]; | 613 const int wrap = s->b8_stride; |
614 const int xy = s->block_index[0]; | 614 const int xy = s->block_index[0]; |
615 | 615 |
616 s->current_picture.mbskip_table[mb_xy]= s->mb_skiped; | 616 s->current_picture.mbskip_table[mb_xy]= s->mb_skiped; |
617 | 617 |
618 if(s->mv_type != MV_TYPE_8X8){ | 618 if(s->mv_type != MV_TYPE_8X8){ |
983 if(interleaved_stats){ | 983 if(interleaved_stats){ |
984 s->misc_bits+= get_bits_diff(s); | 984 s->misc_bits+= get_bits_diff(s); |
985 } | 985 } |
986 | 986 |
987 /* motion vectors: 16x16 mode */ | 987 /* motion vectors: 16x16 mode */ |
988 h263_pred_motion(s, 0, &pred_x, &pred_y); | 988 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
989 | 989 |
990 h263_encode_motion(s, motion_x - pred_x, s->f_code); | 990 h263_encode_motion(s, motion_x - pred_x, s->f_code); |
991 h263_encode_motion(s, motion_y - pred_y, s->f_code); | 991 h263_encode_motion(s, motion_y - pred_y, s->f_code); |
992 }else if(s->mv_type==MV_TYPE_FIELD){ | 992 }else if(s->mv_type==MV_TYPE_FIELD){ |
993 if(s->dquant) cbpc+= 8; | 993 if(s->dquant) cbpc+= 8; |
1007 if(interleaved_stats){ | 1007 if(interleaved_stats){ |
1008 s->misc_bits+= get_bits_diff(s); | 1008 s->misc_bits+= get_bits_diff(s); |
1009 } | 1009 } |
1010 | 1010 |
1011 /* motion vectors: 16x8 interlaced mode */ | 1011 /* motion vectors: 16x8 interlaced mode */ |
1012 h263_pred_motion(s, 0, &pred_x, &pred_y); | 1012 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
1013 pred_y /=2; | 1013 pred_y /=2; |
1014 | 1014 |
1015 put_bits(&s->pb, 1, s->field_select[0][0]); | 1015 put_bits(&s->pb, 1, s->field_select[0][0]); |
1016 put_bits(&s->pb, 1, s->field_select[0][1]); | 1016 put_bits(&s->pb, 1, s->field_select[0][1]); |
1017 | 1017 |
1035 s->misc_bits+= get_bits_diff(s); | 1035 s->misc_bits+= get_bits_diff(s); |
1036 } | 1036 } |
1037 | 1037 |
1038 for(i=0; i<4; i++){ | 1038 for(i=0; i<4; i++){ |
1039 /* motion vectors: 8x8 mode*/ | 1039 /* motion vectors: 8x8 mode*/ |
1040 h263_pred_motion(s, i, &pred_x, &pred_y); | 1040 h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
1041 | 1041 |
1042 h263_encode_motion(s, s->current_picture.motion_val[0][ s->block_index[i] ][0] - pred_x, s->f_code); | 1042 h263_encode_motion(s, s->current_picture.motion_val[0][ s->block_index[i] ][0] - pred_x, s->f_code); |
1043 h263_encode_motion(s, s->current_picture.motion_val[0][ s->block_index[i] ][1] - pred_y, s->f_code); | 1043 h263_encode_motion(s, s->current_picture.motion_val[0][ s->block_index[i] ][1] - pred_y, s->f_code); |
1044 } | 1044 } |
1045 } | 1045 } |
1183 if(interleaved_stats){ | 1183 if(interleaved_stats){ |
1184 s->misc_bits+= get_bits_diff(s); | 1184 s->misc_bits+= get_bits_diff(s); |
1185 } | 1185 } |
1186 | 1186 |
1187 /* motion vectors: 16x16 mode */ | 1187 /* motion vectors: 16x16 mode */ |
1188 h263_pred_motion(s, 0, &pred_x, &pred_y); | 1188 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
1189 | 1189 |
1190 if (!s->umvplus) { | 1190 if (!s->umvplus) { |
1191 h263_encode_motion(s, motion_x - pred_x, 1); | 1191 h263_encode_motion(s, motion_x - pred_x, 1); |
1192 h263_encode_motion(s, motion_y - pred_y, 1); | 1192 h263_encode_motion(s, motion_y - pred_y, 1); |
1193 } | 1193 } |
1210 s->misc_bits+= get_bits_diff(s); | 1210 s->misc_bits+= get_bits_diff(s); |
1211 } | 1211 } |
1212 | 1212 |
1213 for(i=0; i<4; i++){ | 1213 for(i=0; i<4; i++){ |
1214 /* motion vectors: 8x8 mode*/ | 1214 /* motion vectors: 8x8 mode*/ |
1215 h263_pred_motion(s, i, &pred_x, &pred_y); | 1215 h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
1216 | 1216 |
1217 motion_x= s->current_picture.motion_val[0][ s->block_index[i] ][0]; | 1217 motion_x= s->current_picture.motion_val[0][ s->block_index[i] ][0]; |
1218 motion_y= s->current_picture.motion_val[0][ s->block_index[i] ][1]; | 1218 motion_y= s->current_picture.motion_val[0][ s->block_index[i] ][1]; |
1219 if (!s->umvplus) { | 1219 if (!s->umvplus) { |
1220 h263_encode_motion(s, motion_x - pred_x, 1); | 1220 h263_encode_motion(s, motion_x - pred_x, 1); |
1433 int x, y, wrap, a, c, pred_dc, scale; | 1433 int x, y, wrap, a, c, pred_dc, scale; |
1434 int16_t *dc_val, *ac_val; | 1434 int16_t *dc_val, *ac_val; |
1435 | 1435 |
1436 /* find prediction */ | 1436 /* find prediction */ |
1437 if (n < 4) { | 1437 if (n < 4) { |
1438 x = 2 * s->mb_x + 1 + (n & 1); | 1438 x = 2 * s->mb_x + (n & 1); |
1439 y = 2 * s->mb_y + 1 + ((n & 2) >> 1); | 1439 y = 2 * s->mb_y + ((n & 2) >> 1); |
1440 wrap = s->mb_width * 2 + 2; | 1440 wrap = s->b8_stride; |
1441 dc_val = s->dc_val[0]; | 1441 dc_val = s->dc_val[0]; |
1442 ac_val = s->ac_val[0][0]; | 1442 ac_val = s->ac_val[0][0]; |
1443 scale = s->y_dc_scale; | 1443 scale = s->y_dc_scale; |
1444 } else { | 1444 } else { |
1445 x = s->mb_x + 1; | 1445 x = s->mb_x; |
1446 y = s->mb_y + 1; | 1446 y = s->mb_y; |
1447 wrap = s->mb_width + 2; | 1447 wrap = s->mb_stride; |
1448 dc_val = s->dc_val[n - 4 + 1]; | 1448 dc_val = s->dc_val[n - 4 + 1]; |
1449 ac_val = s->ac_val[n - 4 + 1][0]; | 1449 ac_val = s->ac_val[n - 4 + 1][0]; |
1450 scale = s->c_dc_scale; | 1450 scale = s->c_dc_scale; |
1451 } | 1451 } |
1452 /* B C | 1452 /* B C |
1480 int x, y, wrap, a, c, pred_dc, scale, i; | 1480 int x, y, wrap, a, c, pred_dc, scale, i; |
1481 int16_t *dc_val, *ac_val, *ac_val1; | 1481 int16_t *dc_val, *ac_val, *ac_val1; |
1482 | 1482 |
1483 /* find prediction */ | 1483 /* find prediction */ |
1484 if (n < 4) { | 1484 if (n < 4) { |
1485 x = 2 * s->mb_x + 1 + (n & 1); | 1485 x = 2 * s->mb_x + (n & 1); |
1486 y = 2 * s->mb_y + 1 + (n>> 1); | 1486 y = 2 * s->mb_y + (n>> 1); |
1487 wrap = s->mb_width * 2 + 2; | 1487 wrap = s->b8_stride; |
1488 dc_val = s->dc_val[0]; | 1488 dc_val = s->dc_val[0]; |
1489 ac_val = s->ac_val[0][0]; | 1489 ac_val = s->ac_val[0][0]; |
1490 scale = s->y_dc_scale; | 1490 scale = s->y_dc_scale; |
1491 } else { | 1491 } else { |
1492 x = s->mb_x + 1; | 1492 x = s->mb_x; |
1493 y = s->mb_y + 1; | 1493 y = s->mb_y; |
1494 wrap = s->mb_width + 2; | 1494 wrap = s->mb_stride; |
1495 dc_val = s->dc_val[n - 4 + 1]; | 1495 dc_val = s->dc_val[n - 4 + 1]; |
1496 ac_val = s->ac_val[n - 4 + 1][0]; | 1496 ac_val = s->ac_val[n - 4 + 1][0]; |
1497 scale = s->c_dc_scale; | 1497 scale = s->c_dc_scale; |
1498 } | 1498 } |
1499 | 1499 |
1560 /* top copy */ | 1560 /* top copy */ |
1561 for(i=1;i<8;i++) | 1561 for(i=1;i<8;i++) |
1562 ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]]; | 1562 ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]]; |
1563 } | 1563 } |
1564 | 1564 |
1565 int16_t *h263_pred_motion(MpegEncContext * s, int block, | 1565 int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir, |
1566 int *px, int *py) | 1566 int *px, int *py) |
1567 { | 1567 { |
1568 int xy, wrap; | 1568 int wrap; |
1569 int16_t *A, *B, *C, *mot_val; | |
1570 static const int off[4]= {2, 1, 1, -1}; | |
1571 | |
1572 wrap = s->block_wrap[0]; | |
1573 xy = s->block_index[block]; | |
1574 | |
1575 mot_val = s->current_picture.motion_val[0][xy]; | |
1576 | |
1577 A = s->current_picture.motion_val[0][xy - 1]; | |
1578 /* special case for first (slice) line */ | |
1579 if (s->first_slice_line && block<3) { | |
1580 // we cant just change some MVs to simulate that as we need them for the B frames (and ME) | |
1581 // and if we ever support non rectangular objects than we need to do a few ifs here anyway :( | |
1582 if(block==0){ //most common case | |
1583 if(s->mb_x == s->resync_mb_x){ //rare | |
1584 *px= *py = 0; | |
1585 }else if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred){ //rare | |
1586 C = s->current_picture.motion_val[0][xy + off[block] - wrap]; | |
1587 if(s->mb_x==0){ | |
1588 *px = C[0]; | |
1589 *py = C[1]; | |
1590 }else{ | |
1591 *px = mid_pred(A[0], 0, C[0]); | |
1592 *py = mid_pred(A[1], 0, C[1]); | |
1593 } | |
1594 }else{ | |
1595 *px = A[0]; | |
1596 *py = A[1]; | |
1597 } | |
1598 }else if(block==1){ | |
1599 if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred){ //rare | |
1600 C = s->current_picture.motion_val[0][xy + off[block] - wrap]; | |
1601 *px = mid_pred(A[0], 0, C[0]); | |
1602 *py = mid_pred(A[1], 0, C[1]); | |
1603 }else{ | |
1604 *px = A[0]; | |
1605 *py = A[1]; | |
1606 } | |
1607 }else{ /* block==2*/ | |
1608 B = s->current_picture.motion_val[0][xy - wrap]; | |
1609 C = s->current_picture.motion_val[0][xy + off[block] - wrap]; | |
1610 if(s->mb_x == s->resync_mb_x) //rare | |
1611 A[0]=A[1]=0; | |
1612 | |
1613 *px = mid_pred(A[0], B[0], C[0]); | |
1614 *py = mid_pred(A[1], B[1], C[1]); | |
1615 } | |
1616 } else { | |
1617 B = s->current_picture.motion_val[0][xy - wrap]; | |
1618 C = s->current_picture.motion_val[0][xy + off[block] - wrap]; | |
1619 *px = mid_pred(A[0], B[0], C[0]); | |
1620 *py = mid_pred(A[1], B[1], C[1]); | |
1621 } | |
1622 return mot_val; | |
1623 } | |
1624 | |
1625 // identical to above but with s->current_picture->motion_val, the above one will be removed, and this renamed to it | |
1626 int16_t *h263_pred_motion2(MpegEncContext * s, int block, int dir, | |
1627 int *px, int *py) | |
1628 { | |
1629 int xy, wrap; | |
1630 int16_t *A, *B, *C, (*mot_val)[2]; | 1569 int16_t *A, *B, *C, (*mot_val)[2]; |
1631 static const int off[4]= {2, 1, 1, -1}; | 1570 static const int off[4]= {2, 1, 1, -1}; |
1632 | 1571 |
1633 wrap = s->b8_stride; | 1572 wrap = s->b8_stride; |
1634 xy = 2*(s->mb_x + s->mb_y * wrap); | 1573 mot_val = s->current_picture.motion_val[dir] + s->block_index[block]; |
1635 | |
1636 mot_val = s->current_picture.motion_val[dir] + xy; | |
1637 | 1574 |
1638 A = mot_val[ - 1]; | 1575 A = mot_val[ - 1]; |
1639 /* special case for first (slice) line */ | 1576 /* special case for first (slice) line */ |
1640 if (s->first_slice_line && block<3) { | 1577 if (s->first_slice_line && block<3) { |
1641 // we cant just change some MVs to simulate that as we need them for the B frames (and ME) | 1578 // we cant just change some MVs to simulate that as we need them for the B frames (and ME) |
3196 | 3133 |
3197 void ff_mpeg4_clean_buffers(MpegEncContext *s) | 3134 void ff_mpeg4_clean_buffers(MpegEncContext *s) |
3198 { | 3135 { |
3199 int c_wrap, c_xy, l_wrap, l_xy; | 3136 int c_wrap, c_xy, l_wrap, l_xy; |
3200 | 3137 |
3201 l_wrap= s->block_wrap[0]; | 3138 l_wrap= s->b8_stride; |
3202 l_xy= s->mb_y*l_wrap*2 + s->mb_x*2; | 3139 l_xy= (2*s->mb_y-1)*l_wrap + s->mb_x*2 - 1; |
3203 c_wrap= s->block_wrap[4]; | 3140 c_wrap= s->mb_stride; |
3204 c_xy= s->mb_y*c_wrap + s->mb_x; | 3141 c_xy= (s->mb_y-1)*c_wrap + s->mb_x - 1; |
3205 | 3142 |
3206 #if 0 | 3143 #if 0 |
3207 /* clean DC */ | 3144 /* clean DC */ |
3208 memsetw(s->dc_val[0] + l_xy, 1024, l_wrap*2+1); | 3145 memsetw(s->dc_val[0] + l_xy, 1024, l_wrap*2+1); |
3209 memsetw(s->dc_val[1] + c_xy, 1024, c_wrap+1); | 3146 memsetw(s->dc_val[1] + c_xy, 1024, c_wrap+1); |
3372 } | 3309 } |
3373 s->pred_dir_table[xy]= dir; | 3310 s->pred_dir_table[xy]= dir; |
3374 }else{ /* P/S_TYPE */ | 3311 }else{ /* P/S_TYPE */ |
3375 int mx, my, pred_x, pred_y, bits; | 3312 int mx, my, pred_x, pred_y, bits; |
3376 int16_t * const mot_val= s->current_picture.motion_val[0][s->block_index[0]]; | 3313 int16_t * const mot_val= s->current_picture.motion_val[0][s->block_index[0]]; |
3377 const int stride= s->block_wrap[0]*2; | 3314 const int stride= s->b8_stride*2; |
3378 | 3315 |
3379 try_again: | 3316 try_again: |
3380 bits= show_bits(&s->gb, 17); | 3317 bits= show_bits(&s->gb, 17); |
3381 if(bits==MOTION_MARKER){ | 3318 if(bits==MOTION_MARKER){ |
3382 return mb_num-1; | 3319 return mb_num-1; |
3430 else s->mcsel= 0; | 3367 else s->mcsel= 0; |
3431 | 3368 |
3432 if ((cbpc & 16) == 0) { | 3369 if ((cbpc & 16) == 0) { |
3433 /* 16x16 motion prediction */ | 3370 /* 16x16 motion prediction */ |
3434 | 3371 |
3435 h263_pred_motion(s, 0, &pred_x, &pred_y); | 3372 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
3436 if(!s->mcsel){ | 3373 if(!s->mcsel){ |
3437 mx = h263_decode_motion(s, pred_x, s->f_code); | 3374 mx = h263_decode_motion(s, pred_x, s->f_code); |
3438 if (mx >= 0xffff) | 3375 if (mx >= 0xffff) |
3439 return -1; | 3376 return -1; |
3440 | 3377 |
3454 mot_val[1+stride]= mot_val[3+stride]= my; | 3391 mot_val[1+stride]= mot_val[3+stride]= my; |
3455 } else { | 3392 } else { |
3456 int i; | 3393 int i; |
3457 s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0; | 3394 s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0; |
3458 for(i=0;i<4;i++) { | 3395 for(i=0;i<4;i++) { |
3459 int16_t *mot_val= h263_pred_motion(s, i, &pred_x, &pred_y); | 3396 int16_t *mot_val= h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
3460 mx = h263_decode_motion(s, pred_x, s->f_code); | 3397 mx = h263_decode_motion(s, pred_x, s->f_code); |
3461 if (mx >= 0xffff) | 3398 if (mx >= 0xffff) |
3462 return -1; | 3399 return -1; |
3463 | 3400 |
3464 my = h263_decode_motion(s, pred_y, s->f_code); | 3401 my = h263_decode_motion(s, pred_y, s->f_code); |
3708 GetBitContext gb= s->gb; | 3645 GetBitContext gb= s->gb; |
3709 | 3646 |
3710 int cbpc, i, pred_x, pred_y, mx, my; | 3647 int cbpc, i, pred_x, pred_y, mx, my; |
3711 int16_t *mot_val; | 3648 int16_t *mot_val; |
3712 const int xy= s->mb_x + 1 + s->mb_y * s->mb_stride; | 3649 const int xy= s->mb_x + 1 + s->mb_y * s->mb_stride; |
3713 const int stride= s->block_wrap[0]*2; | 3650 const int stride= s->b8_stride*2; |
3714 | 3651 |
3715 for(i=0; i<4; i++) | 3652 for(i=0; i<4; i++) |
3716 s->block_index[i]+= 2; | 3653 s->block_index[i]+= 2; |
3717 for(i=4; i<6; i++) | 3654 for(i=4; i<6; i++) |
3718 s->block_index[i]+= 1; | 3655 s->block_index[i]+= 1; |
3748 } | 3685 } |
3749 | 3686 |
3750 if ((cbpc & 16) == 0) { | 3687 if ((cbpc & 16) == 0) { |
3751 s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0; | 3688 s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0; |
3752 /* 16x16 motion prediction */ | 3689 /* 16x16 motion prediction */ |
3753 mot_val= h263_pred_motion(s, 0, &pred_x, &pred_y); | 3690 mot_val= h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
3754 if (s->umvplus) | 3691 if (s->umvplus) |
3755 mx = h263p_decode_umotion(s, pred_x); | 3692 mx = h263p_decode_umotion(s, pred_x); |
3756 else | 3693 else |
3757 mx = h263_decode_motion(s, pred_x, 1); | 3694 mx = h263_decode_motion(s, pred_x, 1); |
3758 | 3695 |
3766 mot_val[1 ]= mot_val[3 ]= | 3703 mot_val[1 ]= mot_val[3 ]= |
3767 mot_val[1+stride]= mot_val[3+stride]= my; | 3704 mot_val[1+stride]= mot_val[3+stride]= my; |
3768 } else { | 3705 } else { |
3769 s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0; | 3706 s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0; |
3770 for(i=0;i<4;i++) { | 3707 for(i=0;i<4;i++) { |
3771 mot_val = h263_pred_motion(s, i, &pred_x, &pred_y); | 3708 mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
3772 if (s->umvplus) | 3709 if (s->umvplus) |
3773 mx = h263p_decode_umotion(s, pred_x); | 3710 mx = h263p_decode_umotion(s, pred_x); |
3774 else | 3711 else |
3775 mx = h263_decode_motion(s, pred_x, 1); | 3712 mx = h263_decode_motion(s, pred_x, 1); |
3776 | 3713 |
3858 s->mv_dir = MV_DIR_FORWARD; | 3795 s->mv_dir = MV_DIR_FORWARD; |
3859 if ((cbpc & 16) == 0) { | 3796 if ((cbpc & 16) == 0) { |
3860 s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0; | 3797 s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0; |
3861 /* 16x16 motion prediction */ | 3798 /* 16x16 motion prediction */ |
3862 s->mv_type = MV_TYPE_16X16; | 3799 s->mv_type = MV_TYPE_16X16; |
3863 h263_pred_motion(s, 0, &pred_x, &pred_y); | 3800 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
3864 if (s->umvplus) | 3801 if (s->umvplus) |
3865 mx = h263p_decode_umotion(s, pred_x); | 3802 mx = h263p_decode_umotion(s, pred_x); |
3866 else | 3803 else |
3867 mx = h263_decode_motion(s, pred_x, 1); | 3804 mx = h263_decode_motion(s, pred_x, 1); |
3868 | 3805 |
3883 skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */ | 3820 skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */ |
3884 } else { | 3821 } else { |
3885 s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0; | 3822 s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0; |
3886 s->mv_type = MV_TYPE_8X8; | 3823 s->mv_type = MV_TYPE_8X8; |
3887 for(i=0;i<4;i++) { | 3824 for(i=0;i<4;i++) { |
3888 mot_val = h263_pred_motion(s, i, &pred_x, &pred_y); | 3825 mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
3889 if (s->umvplus) | 3826 if (s->umvplus) |
3890 mx = h263p_decode_umotion(s, pred_x); | 3827 mx = h263p_decode_umotion(s, pred_x); |
3891 else | 3828 else |
3892 mx = h263_decode_motion(s, pred_x, 1); | 3829 mx = h263_decode_motion(s, pred_x, 1); |
3893 if (mx >= 0xffff) | 3830 if (mx >= 0xffff) |
3977 s->mv_dir = 0; | 3914 s->mv_dir = 0; |
3978 s->mv_type= MV_TYPE_16X16; | 3915 s->mv_type= MV_TYPE_16X16; |
3979 //FIXME UMV | 3916 //FIXME UMV |
3980 | 3917 |
3981 if(USES_LIST(mb_type, 0)){ | 3918 if(USES_LIST(mb_type, 0)){ |
3982 int16_t *mot_val= h263_pred_motion2(s, 0, 0, &mx, &my); | 3919 int16_t *mot_val= h263_pred_motion(s, 0, 0, &mx, &my); |
3983 s->mv_dir = MV_DIR_FORWARD; | 3920 s->mv_dir = MV_DIR_FORWARD; |
3984 | 3921 |
3985 mx = h263_decode_motion(s, mx, 1); | 3922 mx = h263_decode_motion(s, mx, 1); |
3986 my = h263_decode_motion(s, my, 1); | 3923 my = h263_decode_motion(s, my, 1); |
3987 | 3924 |
3990 mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx; | 3927 mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx; |
3991 mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; | 3928 mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; |
3992 } | 3929 } |
3993 | 3930 |
3994 if(USES_LIST(mb_type, 1)){ | 3931 if(USES_LIST(mb_type, 1)){ |
3995 int16_t *mot_val= h263_pred_motion2(s, 0, 1, &mx, &my); | 3932 int16_t *mot_val= h263_pred_motion(s, 0, 1, &mx, &my); |
3996 s->mv_dir |= MV_DIR_BACKWARD; | 3933 s->mv_dir |= MV_DIR_BACKWARD; |
3997 | 3934 |
3998 mx = h263_decode_motion(s, mx, 1); | 3935 mx = h263_decode_motion(s, mx, 1); |
3999 my = h263_decode_motion(s, my, 1); | 3936 my = h263_decode_motion(s, my, 1); |
4000 | 3937 |
4145 s->mv_type= MV_TYPE_FIELD; | 4082 s->mv_type= MV_TYPE_FIELD; |
4146 | 4083 |
4147 s->field_select[0][0]= get_bits1(&s->gb); | 4084 s->field_select[0][0]= get_bits1(&s->gb); |
4148 s->field_select[0][1]= get_bits1(&s->gb); | 4085 s->field_select[0][1]= get_bits1(&s->gb); |
4149 | 4086 |
4150 h263_pred_motion(s, 0, &pred_x, &pred_y); | 4087 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
4151 | 4088 |
4152 for(i=0; i<2; i++){ | 4089 for(i=0; i<2; i++){ |
4153 mx = h263_decode_motion(s, pred_x, s->f_code); | 4090 mx = h263_decode_motion(s, pred_x, s->f_code); |
4154 if (mx >= 0xffff) | 4091 if (mx >= 0xffff) |
4155 return -1; | 4092 return -1; |
4163 } | 4100 } |
4164 }else{ | 4101 }else{ |
4165 s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0; | 4102 s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0; |
4166 /* 16x16 motion prediction */ | 4103 /* 16x16 motion prediction */ |
4167 s->mv_type = MV_TYPE_16X16; | 4104 s->mv_type = MV_TYPE_16X16; |
4168 h263_pred_motion(s, 0, &pred_x, &pred_y); | 4105 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
4169 mx = h263_decode_motion(s, pred_x, s->f_code); | 4106 mx = h263_decode_motion(s, pred_x, s->f_code); |
4170 | 4107 |
4171 if (mx >= 0xffff) | 4108 if (mx >= 0xffff) |
4172 return -1; | 4109 return -1; |
4173 | 4110 |
4180 } | 4117 } |
4181 } else { | 4118 } else { |
4182 s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0; | 4119 s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0; |
4183 s->mv_type = MV_TYPE_8X8; | 4120 s->mv_type = MV_TYPE_8X8; |
4184 for(i=0;i<4;i++) { | 4121 for(i=0;i<4;i++) { |
4185 mot_val = h263_pred_motion(s, i, &pred_x, &pred_y); | 4122 mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
4186 mx = h263_decode_motion(s, pred_x, s->f_code); | 4123 mx = h263_decode_motion(s, pred_x, s->f_code); |
4187 if (mx >= 0xffff) | 4124 if (mx >= 0xffff) |
4188 return -1; | 4125 return -1; |
4189 | 4126 |
4190 my = h263_decode_motion(s, pred_y, s->f_code); | 4127 my = h263_decode_motion(s, pred_y, s->f_code); |