Unified · Split
| @@ -350,6 +350,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir) · 349 unmodified lines | |||
| 350 | int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; | 350 | int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; |
| 351 | int off, off_uv; | 351 | int off, off_uv; |
| 352 | int v_edge_pos = s->v_edge_pos >> v->field_mode; | 352 | int v_edge_pos = s->v_edge_pos >> v->field_mode; |
| 353 | int i; | ||
| 353 | 354 | ||
| 354 | if ((!v->field_mode || | 355 | if ((!v->field_mode || |
| 355 | (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && | 356 | (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && |
| @@ -361,8 +362,10 @@ static void vc1_mc_1mv(VC1Context *v, int dir) · 5 unmodified lines | |||
| 361 | 362 | ||
| 362 | // store motion vectors for further use in B frames | 363 | // store motion vectors for further use in B frames |
| 363 | if (s->pict_type == AV_PICTURE_TYPE_P) { | 364 | if (s->pict_type == AV_PICTURE_TYPE_P) { |
| 364 | s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][0] = mx; | 365 | for (i = 0; i < 4; i++) { |
| 365 | s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][1] = my; | 366 | s->current_picture.motion_val[1][s->block_index[i] + v->blocks_off][0] = mx; |
| 367 | s->current_picture.motion_val[1][s->block_index[i] + v->blocks_off][1] = my; | ||
| 368 | } | ||
| 366 | } | 369 | } |
| 367 | 370 | ||
| 368 | uvmx = (mx + ((mx & 3) == 3)) >> 1; | 371 | uvmx = (mx + ((mx & 3) == 3)) >> 1; |
| @@ -553,7 +556,7 @@ static inline int median4(int a, int b, int c, int d) · 184 unmodified lines | |||
| 553 | 556 | ||
| 554 | /** Do motion compensation for 4-MV macroblock - luminance block | 557 | /** Do motion compensation for 4-MV macroblock - luminance block |
| 555 | */ | 558 | */ |
| 556 | static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) | 559 | static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) |
| 557 | { | 560 | { |
| 558 | MpegEncContext *s = &v->s; | 561 | MpegEncContext *s = &v->s; |
| 559 | uint8_t *srcY; | 562 | uint8_t *srcY; |
| @@ -629,6 +632,10 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) · 69 unmodified lines | |||
| 629 | int qx, qy; | 632 | int qx, qy; |
| 630 | int width = s->avctx->coded_width; | 633 | int width = s->avctx->coded_width; |
| 631 | int height = s->avctx->coded_height >> 1; | 634 | int height = s->avctx->coded_height >> 1; |
| 635 | if (s->pict_type == AV_PICTURE_TYPE_P) { | ||
| 636 | s->current_picture.motion_val[1][s->block_index[n] + v->blocks_off][0] = mx; | ||
| 637 | s->current_picture.motion_val[1][s->block_index[n] + v->blocks_off][1] = my; | ||
| 638 | } | ||
| 632 | qx = (s->mb_x * 16) + (mx >> 2); | 639 | qx = (s->mb_x * 16) + (mx >> 2); |
| 633 | qy = (s->mb_y * 8) + (my >> 3); | 640 | qy = (s->mb_y * 8) + (my >> 3); |
| 634 | 641 | ||
| @@ -716,7 +723,10 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) · 81 unmodified lines | |||
| 716 | 723 | ||
| 717 | if (s->mspel) { | 724 | if (s->mspel) { |
| 718 | dxy = ((my & 3) << 2) | (mx & 3); | 725 | dxy = ((my & 3) << 2) | (mx & 3); |
| 719 | v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); | 726 | if (avg) |
| 727 | v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); | ||
| 728 | else | ||
| 729 | v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); | ||
| 720 | } else { // hpel mc - always used for luma | 730 | } else { // hpel mc - always used for luma |
| 721 | dxy = (my & 2) | ((mx & 2) >> 1); | 731 | dxy = (my & 2) | ((mx & 2) >> 1); |
| 722 | if (!v->rnd) | 732 | if (!v->rnd) |
| @@ -1622,7 +1632,7 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, · 899 unmodified lines | |||
| 1622 | /** Predict and set motion vector for interlaced frame picture MBs | 1632 | /** Predict and set motion vector for interlaced frame picture MBs |
| 1623 | */ | 1633 | */ |
| 1624 | static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, | 1634 | static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, |
| 1625 | int mvn, int r_x, int r_y, uint8_t* is_intra) | 1635 | int mvn, int r_x, int r_y, uint8_t* is_intra, int dir) |
| 1626 | { | 1636 | { |
| 1627 | MpegEncContext *s = &v->s; | 1637 | MpegEncContext *s = &v->s; |
| 1628 | int xy, wrap, off = 0; | 1638 | int xy, wrap, off = 0; |
| @@ -1664,14 +1674,14 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, · 35 unmodified lines | |||
| 1664 | if (s->mb_x || (n == 1) || (n == 3)) { | 1674 | if (s->mb_x || (n == 1) || (n == 3)) { |
| 1665 | if ((v->blk_mv_type[xy]) // current block (MB) has a field MV | 1675 | if ((v->blk_mv_type[xy]) // current block (MB) has a field MV |
| 1666 | || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { // or both have frame MV | 1676 | || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { // or both have frame MV |
| 1667 | A[0] = s->current_picture.motion_val[0][xy - 1][0]; | 1677 | A[0] = s->current_picture.motion_val[dir][xy - 1][0]; |
| 1668 | A[1] = s->current_picture.motion_val[0][xy - 1][1]; | 1678 | A[1] = s->current_picture.motion_val[dir][xy - 1][1]; |
| 1669 | a_valid = 1; | 1679 | a_valid = 1; |
| 1670 | } else { // current block has frame mv and cand. has field MV (so average) | 1680 | } else { // current block has frame mv and cand. has field MV (so average) |
| 1671 | A[0] = (s->current_picture.motion_val[0][xy - 1][0] | 1681 | A[0] = (s->current_picture.motion_val[dir][xy - 1][0] |
| 1672 | + s->current_picture.motion_val[0][xy - 1 + off * wrap][0] + 1) >> 1; | 1682 | + s->current_picture.motion_val[dir][xy - 1 + off * wrap][0] + 1) >> 1; |
| 1673 | A[1] = (s->current_picture.motion_val[0][xy - 1][1] | 1683 | A[1] = (s->current_picture.motion_val[dir][xy - 1][1] |
| 1674 | + s->current_picture.motion_val[0][xy - 1 + off * wrap][1] + 1) >> 1; | 1684 | + s->current_picture.motion_val[dir][xy - 1 + off * wrap][1] + 1) >> 1; |
| 1675 | a_valid = 1; | 1685 | a_valid = 1; |
| 1676 | } | 1686 | } |
| 1677 | if (!(n & 1) && v->is_intra[s->mb_x - 1]) { | 1687 | if (!(n & 1) && v->is_intra[s->mb_x - 1]) { |
| @@ -1691,11 +1701,11 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, · 13 unmodified lines | |||
| 1691 | if (v->blk_mv_type[pos_b] && v->blk_mv_type[xy]) { | 1701 | if (v->blk_mv_type[pos_b] && v->blk_mv_type[xy]) { |
| 1692 | n_adj = (n & 2) | (n & 1); | 1702 | n_adj = (n & 2) | (n & 1); |
| 1693 | } | 1703 | } |
| 1694 | B[0] = s->current_picture.motion_val[0][s->block_index[n_adj] - 2 * wrap][0]; | 1704 | B[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][0]; |
| 1695 | B[1] = s->current_picture.motion_val[0][s->block_index[n_adj] - 2 * wrap][1]; | 1705 | B[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][1]; |
| 1696 | if (v->blk_mv_type[pos_b] && !v->blk_mv_type[xy]) { | 1706 | if (v->blk_mv_type[pos_b] && !v->blk_mv_type[xy]) { |
| 1697 | B[0] = (B[0] + s->current_picture.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; | 1707 | B[0] = (B[0] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; |
| 1698 | B[1] = (B[1] + s->current_picture.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; | 1708 | B[1] = (B[1] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; |
| 1699 | } | 1709 | } |
| 1700 | } | 1710 | } |
| 1701 | if (s->mb_width > 1) { | 1711 | if (s->mb_width > 1) { |
| @@ -1706,11 +1716,11 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, · 4 unmodified lines | |||
| 1706 | if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { | 1716 | if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { |
| 1707 | n_adj = n & 2; | 1717 | n_adj = n & 2; |
| 1708 | } | 1718 | } |
| 1709 | C[0] = s->current_picture.motion_val[0][s->block_index[n_adj] - 2 * wrap + 2][0]; | 1719 | C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][0]; |
| 1710 | C[1] = s->current_picture.motion_val[0][s->block_index[n_adj] - 2 * wrap + 2][1]; | 1720 | C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][1]; |
| 1711 | if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { | 1721 | if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { |
| 1712 | C[0] = (1 + C[0] + (s->current_picture.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; | 1722 | C[0] = (1 + C[0] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; |
| 1713 | C[1] = (1 + C[1] + (s->current_picture.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; | 1723 | C[1] = (1 + C[1] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; |
| 1714 | } | 1724 | } |
| 1715 | if (s->mb_x == s->mb_width - 1) { | 1725 | if (s->mb_x == s->mb_width - 1) { |
| 1716 | if (!v->is_intra[s->mb_x - s->mb_stride - 1]) { | 1726 | if (!v->is_intra[s->mb_x - s->mb_stride - 1]) { |
| @@ -1720,11 +1730,11 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, · 3 unmodified lines | |||
| 1720 | if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { | 1730 | if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { |
| 1721 | n_adj = n | 1; | 1731 | n_adj = n | 1; |
| 1722 | } | 1732 | } |
| 1723 | C[0] = s->current_picture.motion_val[0][s->block_index[n_adj] - 2 * wrap - 2][0]; | 1733 | C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][0]; |
| 1724 | C[1] = s->current_picture.motion_val[0][s->block_index[n_adj] - 2 * wrap - 2][1]; | 1734 | C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][1]; |
| 1725 | if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { | 1735 | if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { |
| 1726 | C[0] = (1 + C[0] + s->current_picture.motion_val[0][s->block_index[1] - 2 * wrap - 2][0]) >> 1; | 1736 | C[0] = (1 + C[0] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][0]) >> 1; |
| 1727 | C[1] = (1 + C[1] + s->current_picture.motion_val[0][s->block_index[1] - 2 * wrap - 2][1]) >> 1; | 1737 | C[1] = (1 + C[1] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][1]) >> 1; |
| 1728 | } | 1738 | } |
| 1729 | } else | 1739 | } else |
| 1730 | c_valid = 0; | 1740 | c_valid = 0; |
| @@ -1735,12 +1745,12 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, · 4 unmodified lines | |||
| 1735 | } else { | 1745 | } else { |
| 1736 | pos_b = s->block_index[1]; | 1746 | pos_b = s->block_index[1]; |
| 1737 | b_valid = 1; | 1747 | b_valid = 1; |
| 1738 | B[0] = s->current_picture.motion_val[0][pos_b][0]; | 1748 | B[0] = s->current_picture.motion_val[dir][pos_b][0]; |
| 1739 | B[1] = s->current_picture.motion_val[0][pos_b][1]; | 1749 | B[1] = s->current_picture.motion_val[dir][pos_b][1]; |
| 1740 | pos_c = s->block_index[0]; | 1750 | pos_c = s->block_index[0]; |
| 1741 | c_valid = 1; | 1751 | c_valid = 1; |
| 1742 | C[0] = s->current_picture.motion_val[0][pos_c][0]; | 1752 | C[0] = s->current_picture.motion_val[dir][pos_c][0]; |
| 1743 | C[1] = s->current_picture.motion_val[0][pos_c][1]; | 1753 | C[1] = s->current_picture.motion_val[dir][pos_c][1]; |
| 1744 | } | 1754 | } |
| 1745 | 1755 | ||
| 1746 | total_valid = a_valid + b_valid + c_valid; | 1756 | total_valid = a_valid + b_valid + c_valid; |
| @@ -1829,20 +1839,20 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, · 82 unmodified lines | |||
| 1829 | } | 1839 | } |
| 1830 | 1840 | ||
| 1831 | /* store MV using signed modulus of MV range defined in 4.11 */ | 1841 | /* store MV using signed modulus of MV range defined in 4.11 */ |
| 1832 | s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; | 1842 | s->mv[dir][n][0] = s->current_picture.motion_val[dir][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; |
| 1833 | s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; | 1843 | s->mv[dir][n][1] = s->current_picture.motion_val[dir][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; |
| 1834 | if (mvn == 1) { /* duplicate motion data for 1-MV block */ | 1844 | if (mvn == 1) { /* duplicate motion data for 1-MV block */ |
| 1835 | s->current_picture.motion_val[0][xy + 1 ][0] = s->current_picture.motion_val[0][xy][0]; | 1845 | s->current_picture.motion_val[dir][xy + 1 ][0] = s->current_picture.motion_val[dir][xy][0]; |
| 1836 | s->current_picture.motion_val[0][xy + 1 ][1] = s->current_picture.motion_val[0][xy][1]; | 1846 | s->current_picture.motion_val[dir][xy + 1 ][1] = s->current_picture.motion_val[dir][xy][1]; |
| 1837 | s->current_picture.motion_val[0][xy + wrap ][0] = s->current_picture.motion_val[0][xy][0]; | 1847 | s->current_picture.motion_val[dir][xy + wrap ][0] = s->current_picture.motion_val[dir][xy][0]; |
| 1838 | s->current_picture.motion_val[0][xy + wrap ][1] = s->current_picture.motion_val[0][xy][1]; | 1848 | s->current_picture.motion_val[dir][xy + wrap ][1] = s->current_picture.motion_val[dir][xy][1]; |
| 1839 | s->current_picture.motion_val[0][xy + wrap + 1][0] = s->current_picture.motion_val[0][xy][0]; | 1849 | s->current_picture.motion_val[dir][xy + wrap + 1][0] = s->current_picture.motion_val[dir][xy][0]; |
| 1840 | s->current_picture.motion_val[0][xy + wrap + 1][1] = s->current_picture.motion_val[0][xy][1]; | 1850 | s->current_picture.motion_val[dir][xy + wrap + 1][1] = s->current_picture.motion_val[dir][xy][1]; |
| 1841 | } else if (mvn == 2) { /* duplicate motion data for 2-Field MV block */ | 1851 | } else if (mvn == 2) { /* duplicate motion data for 2-Field MV block */ |
| 1842 | s->current_picture.motion_val[0][xy + 1][0] = s->current_picture.motion_val[0][xy][0]; | 1852 | s->current_picture.motion_val[dir][xy + 1][0] = s->current_picture.motion_val[dir][xy][0]; |
| 1843 | s->current_picture.motion_val[0][xy + 1][1] = s->current_picture.motion_val[0][xy][1]; | 1853 | s->current_picture.motion_val[dir][xy + 1][1] = s->current_picture.motion_val[dir][xy][1]; |
| 1844 | s->mv[0][n + 1][0] = s->mv[0][n][0]; | 1854 | s->mv[dir][n + 1][0] = s->mv[dir][n][0]; |
| 1845 | s->mv[0][n + 1][1] = s->mv[0][n][1]; | 1855 | s->mv[dir][n + 1][1] = s->mv[dir][n][1]; |
| 1846 | } | 1856 | } |
| 1847 | } | 1857 | } |
| 1848 | 1858 | ||
| @@ -3588,7 +3598,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 1739 unmodified lines | |||
| 3588 | } | 3598 | } |
| 3589 | vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); | 3599 | vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); |
| 3590 | if (!s->mb_intra) | 3600 | if (!s->mb_intra) |
| 3591 | vc1_mc_4mv_luma(v, i, 0); | 3601 | vc1_mc_4mv_luma(v, i, 0, 0); |
| 3592 | intra_count += s->mb_intra; | 3602 | intra_count += s->mb_intra; |
| 3593 | is_intra[i] = s->mb_intra; | 3603 | is_intra[i] = s->mb_intra; |
| 3594 | is_coded[i] = mb_has_coeffs; | 3604 | is_coded[i] = mb_has_coeffs; |
| @@ -3678,7 +3688,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 83 unmodified lines | |||
| 3678 | } | 3688 | } |
| 3679 | for (i = 0; i < 4; i++) { | 3689 | for (i = 0; i < 4; i++) { |
| 3680 | vc1_pred_mv(v, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); | 3690 | vc1_pred_mv(v, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); |
| 3681 | vc1_mc_4mv_luma(v, i, 0); | 3691 | vc1_mc_4mv_luma(v, i, 0, 0); |
| 3682 | } | 3692 | } |
| 3683 | vc1_mc_4mv_chroma(v, 0); | 3693 | vc1_mc_4mv_chroma(v, 0); |
| 3684 | s->current_picture.qscale_table[mb_pos] = 0; | 3694 | s->current_picture.qscale_table[mb_pos] = 0; |
| @@ -3756,8 +3766,10 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 71 unmodified lines | |||
| 3756 | break; | 3766 | break; |
| 3757 | } | 3767 | } |
| 3758 | if (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB | 3768 | if (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB |
| 3759 | s->current_picture.motion_val[1][s->block_index[0]][0] = 0; | 3769 | for (i = 0; i < 4; i++) { |
| 3760 | s->current_picture.motion_val[1][s->block_index[0]][1] = 0; | 3770 | s->current_picture.motion_val[1][s->block_index[i]][0] = 0; |
| 3771 | s->current_picture.motion_val[1][s->block_index[i]][1] = 0; | ||
| 3772 | } | ||
| 3761 | s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; | 3773 | s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; |
| 3762 | s->mb_intra = v->is_intra[s->mb_x] = 1; | 3774 | s->mb_intra = v->is_intra[s->mb_x] = 1; |
| 3763 | for (i = 0; i < 6; i++) | 3775 | for (i = 0; i < 6; i++) |
| @@ -3826,8 +3838,8 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 62 unmodified lines | |||
| 3826 | if (val) { | 3838 | if (val) { |
| 3827 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | 3839 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); |
| 3828 | } | 3840 | } |
| 3829 | vc1_pred_mv_intfr(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]); | 3841 | vc1_pred_mv_intfr(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], 0); |
| 3830 | vc1_mc_4mv_luma(v, i, 0); | 3842 | vc1_mc_4mv_luma(v, i, 0, 0); |
| 3831 | } else if (i == 4) { | 3843 | } else if (i == 4) { |
| 3832 | vc1_mc_4mv_chroma4(v); | 3844 | vc1_mc_4mv_chroma4(v); |
| 3833 | } | 3845 | } |
| @@ -3838,16 +3850,16 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 4 unmodified lines | |||
| 3838 | if (mvbp & 2) { | 3850 | if (mvbp & 2) { |
| 3839 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | 3851 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); |
| 3840 | } | 3852 | } |
| 3841 | vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0]); | 3853 | vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], 0); |
| 3842 | vc1_mc_4mv_luma(v, 0, 0); | 3854 | vc1_mc_4mv_luma(v, 0, 0, 0); |
| 3843 | vc1_mc_4mv_luma(v, 1, 0); | 3855 | vc1_mc_4mv_luma(v, 1, 0, 0); |
| 3844 | dmv_x = dmv_y = 0; | 3856 | dmv_x = dmv_y = 0; |
| 3845 | if (mvbp & 1) { | 3857 | if (mvbp & 1) { |
| 3846 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | 3858 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); |
| 3847 | } | 3859 | } |
| 3848 | vc1_pred_mv_intfr(v, 2, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0]); | 3860 | vc1_pred_mv_intfr(v, 2, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], 0); |
| 3849 | vc1_mc_4mv_luma(v, 2, 0); | 3861 | vc1_mc_4mv_luma(v, 2, 0, 0); |
| 3850 | vc1_mc_4mv_luma(v, 3, 0); | 3862 | vc1_mc_4mv_luma(v, 3, 0, 0); |
| 3851 | vc1_mc_4mv_chroma4(v); | 3863 | vc1_mc_4mv_chroma4(v); |
| 3852 | } else { | 3864 | } else { |
| 3853 | mvbp = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][2]; | 3865 | mvbp = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][2]; |
| @@ -3855,7 +3867,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 1 unmodified line | |||
| 3855 | if (mvbp) { | 3867 | if (mvbp) { |
| 3856 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | 3868 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); |
| 3857 | } | 3869 | } |
| 3858 | vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]); | 3870 | vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0); |
| 3859 | vc1_mc_1mv(v, 0); | 3871 | vc1_mc_1mv(v, 0); |
| 3860 | } | 3872 | } |
| 3861 | if (cbp) | 3873 | if (cbp) |
| @@ -3895,7 +3907,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 33 unmodified lines | |||
| 3895 | v->blk_mv_type[s->block_index[1]] = 0; | 3907 | v->blk_mv_type[s->block_index[1]] = 0; |
| 3896 | v->blk_mv_type[s->block_index[2]] = 0; | 3908 | v->blk_mv_type[s->block_index[2]] = 0; |
| 3897 | v->blk_mv_type[s->block_index[3]] = 0; | 3909 | v->blk_mv_type[s->block_index[3]] = 0; |
| 3898 | vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]); | 3910 | vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0); |
| 3899 | vc1_mc_1mv(v, 0); | 3911 | vc1_mc_1mv(v, 0); |
| 3900 | } | 3912 | } |
| 3901 | if (s->mb_x == s->mb_width - 1) | 3913 | if (s->mb_x == s->mb_width - 1) |
| @@ -3982,7 +3994,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 80 unmodified lines | |||
| 3982 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag); | 3994 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag); |
| 3983 | } | 3995 | } |
| 3984 | vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], pred_flag, 0); | 3996 | vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], pred_flag, 0); |
| 3985 | vc1_mc_4mv_luma(v, i, 0); | 3997 | vc1_mc_4mv_luma(v, i, 0, 0); |
| 3986 | } else if (i == 4) | 3998 | } else if (i == 4) |
| 3987 | vc1_mc_4mv_chroma(v, 0); | 3999 | vc1_mc_4mv_chroma(v, 0); |
| 3988 | } | 4000 | } |
| @@ -4291,7 +4303,7 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) · 302 unmodified lines | |||
| 4291 | &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); | 4303 | &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); |
| 4292 | } | 4304 | } |
| 4293 | vc1_pred_b_mv_intfi(v, i, dmv_x, dmv_y, 0, pred_flag); | 4305 | vc1_pred_b_mv_intfi(v, i, dmv_x, dmv_y, 0, pred_flag); |
| 4294 | vc1_mc_4mv_luma(v, i, bmvtype == BMV_TYPE_BACKWARD); | 4306 | vc1_mc_4mv_luma(v, i, bmvtype == BMV_TYPE_BACKWARD, 0); |
| 4295 | } else if (i == 4) | 4307 | } else if (i == 4) |
| 4296 | vc1_mc_4mv_chroma(v, bmvtype == BMV_TYPE_BACKWARD); | 4308 | vc1_mc_4mv_chroma(v, bmvtype == BMV_TYPE_BACKWARD); |
| 4297 | } | 4309 | } |
| @@ -4325,6 +4337,355 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) · 27 unmodified lines | |||
| 4325 | } | 4337 | } |
| 4326 | } | 4338 | } |
| 4327 | 4339 | ||
| 4340 | /** Decode one B-frame MB (in interlaced frame B picture) | ||
| 4341 | */ | ||
| 4342 | static int vc1_decode_b_mb_intfr(VC1Context *v) | ||
| 4343 | { | ||
| 4344 | MpegEncContext *s = &v->s; | ||
| 4345 | GetBitContext *gb = &s->gb; | ||
| 4346 | int i, j; | ||
| 4347 | int mb_pos = s->mb_x + s->mb_y * s->mb_stride; | ||
| 4348 | int cbp = 0; /* cbp decoding stuff */ | ||
| 4349 | int mqdiff, mquant; /* MB quantization */ | ||
| 4350 | int ttmb = v->ttfrm; /* MB Transform type */ | ||
| 4351 | int mvsw = 0; /* motion vector switch */ | ||
| 4352 | int mb_has_coeffs = 1; /* last_flag */ | ||
| 4353 | int dmv_x, dmv_y; /* Differential MV components */ | ||
| 4354 | int val; /* temp value */ | ||
| 4355 | int first_block = 1; | ||
| 4356 | int dst_idx, off; | ||
| 4357 | int skipped, direct, twomv = 0; | ||
| 4358 | int block_cbp = 0, pat, block_tt = 0; | ||
| 4359 | int idx_mbmode = 0, mvbp; | ||
| 4360 | int stride_y, fieldtx; | ||
| 4361 | int bmvtype = BMV_TYPE_BACKWARD; | ||
| 4362 | int dir, dir2; | ||
| 4363 | |||
| 4364 | mquant = v->pq; /* Lossy initialization */ | ||
| 4365 | s->mb_intra = 0; | ||
| 4366 | if (v->skip_is_raw) | ||
| 4367 | skipped = get_bits1(gb); | ||
| 4368 | else | ||
| 4369 | skipped = v->s.mbskip_table[mb_pos]; | ||
| 4370 | |||
| 4371 | if (!skipped) { | ||
| 4372 | idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2); | ||
| 4373 | if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) | ||
| 4374 | { | ||
| 4375 | twomv = 1; | ||
| 4376 | v->blk_mv_type[s->block_index[0]] = 1; | ||
| 4377 | v->blk_mv_type[s->block_index[1]] = 1; | ||
| 4378 | v->blk_mv_type[s->block_index[2]] = 1; | ||
| 4379 | v->blk_mv_type[s->block_index[3]] = 1; | ||
| 4380 | } else { | ||
| 4381 | v->blk_mv_type[s->block_index[0]] = 0; | ||
| 4382 | v->blk_mv_type[s->block_index[1]] = 0; | ||
| 4383 | v->blk_mv_type[s->block_index[2]] = 0; | ||
| 4384 | v->blk_mv_type[s->block_index[3]] = 0; | ||
| 4385 | } | ||
| 4386 | } | ||
| 4387 | |||
| 4388 | if (v->dmb_is_raw) | ||
| 4389 | direct = get_bits1(gb); | ||
| 4390 | else | ||
| 4391 | direct = v->direct_mb_plane[mb_pos]; | ||
| 4392 | |||
| 4393 | if (direct) { | ||
| 4394 | s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample); | ||
| 4395 | s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample); | ||
| 4396 | s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, s->quarter_sample); | ||
| 4397 | s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, s->quarter_sample); | ||
| 4398 | |||
| 4399 | if (twomv) { | ||
| 4400 | s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, s->quarter_sample); | ||
| 4401 | s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, s->quarter_sample); | ||
| 4402 | s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, s->quarter_sample); | ||
| 4403 | s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, s->quarter_sample); | ||
| 4404 | |||
| 4405 | for (i = 1; i < 4; i+=2) { | ||
| 4406 | s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0]; | ||
| 4407 | s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1]; | ||
| 4408 | s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0]; | ||
| 4409 | s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1]; | ||
| 4410 | } | ||
| 4411 | } else { | ||
| 4412 | for (i = 1; i < 4; i++) { | ||
| 4413 | s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0]; | ||
| 4414 | s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1]; | ||
| 4415 | s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0]; | ||
| 4416 | s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1]; | ||
| 4417 | } | ||
| 4418 | } | ||
| 4419 | } | ||
| 4420 | |||
| 4421 | if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB | ||
| 4422 | for (i = 0; i < 4; i++) { | ||
| 4423 | s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = 0; | ||
| 4424 | s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = 0; | ||
| 4425 | s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = 0; | ||
| 4426 | s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = 0; | ||
| 4427 | } | ||
| 4428 | s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; | ||
| 4429 | s->mb_intra = v->is_intra[s->mb_x] = 1; | ||
| 4430 | for (i = 0; i < 6; i++) | ||
| 4431 | v->mb_type[0][s->block_index[i]] = 1; | ||
| 4432 | fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); | ||
| 4433 | mb_has_coeffs = get_bits1(gb); | ||
| 4434 | if (mb_has_coeffs) | ||
| 4435 | cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); | ||
| 4436 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); | ||
| 4437 | GET_MQUANT(); | ||
| 4438 | s->current_picture.qscale_table[mb_pos] = mquant; | ||
| 4439 | /* Set DC scale - y and c use the same (not sure if necessary here) */ | ||
| 4440 | s->y_dc_scale = s->y_dc_scale_table[mquant]; | ||
| 4441 | s->c_dc_scale = s->c_dc_scale_table[mquant]; | ||
| 4442 | dst_idx = 0; | ||
| 4443 | for (i = 0; i < 6; i++) { | ||
| 4444 | s->dc_val[0][s->block_index[i]] = 0; | ||
| 4445 | dst_idx += i >> 2; | ||
| 4446 | val = ((cbp >> (5 - i)) & 1); | ||
| 4447 | v->mb_type[0][s->block_index[i]] = s->mb_intra; | ||
| 4448 | v->a_avail = v->c_avail = 0; | ||
| 4449 | if (i == 2 || i == 3 || !s->first_slice_line) | ||
| 4450 | v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; | ||
| 4451 | if (i == 1 || i == 3 || s->mb_x) | ||
| 4452 | v->c_avail = v->mb_type[0][s->block_index[i] - 1]; | ||
| 4453 | |||
| 4454 | vc1_decode_intra_block(v, s->block[i], i, val, mquant, | ||
| 4455 | (i & 4) ? v->codingset2 : v->codingset); | ||
| 4456 | if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; | ||
| 4457 | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | ||
| 4458 | if (i < 4) { | ||
| 4459 | stride_y = s->linesize << fieldtx; | ||
| 4460 | off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize; | ||
| 4461 | } else { | ||
| 4462 | stride_y = s->uvlinesize; | ||
| 4463 | off = 0; | ||
| 4464 | } | ||
| 4465 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, stride_y); | ||
| 4466 | } | ||
| 4467 | } else { | ||
| 4468 | s->mb_intra = v->is_intra[s->mb_x] = 0; | ||
| 4469 | if (!direct) { | ||
| 4470 | if (skipped || !s->mb_intra) { | ||
| 4471 | bmvtype = decode012(gb); | ||
| 4472 | switch (bmvtype) { | ||
| 4473 | case 0: | ||
| 4474 | bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD; | ||
| 4475 | break; | ||
| 4476 | case 1: | ||
| 4477 | bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD; | ||
| 4478 | break; | ||
| 4479 | case 2: | ||
| 4480 | bmvtype = BMV_TYPE_INTERPOLATED; | ||
| 4481 | } | ||
| 4482 | } | ||
| 4483 | |||
| 4484 | if (twomv && bmvtype != BMV_TYPE_INTERPOLATED) | ||
| 4485 | mvsw = get_bits1(gb); | ||
| 4486 | } | ||
| 4487 | |||
| 4488 | if (!skipped) { // inter MB | ||
| 4489 | mb_has_coeffs = ff_vc1_mbmode_intfrp[0][idx_mbmode][3]; | ||
| 4490 | if (mb_has_coeffs) | ||
| 4491 | cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); | ||
| 4492 | if (!direct) { | ||
| 4493 | if (bmvtype == BMV_TYPE_INTERPOLATED & twomv) { | ||
| 4494 | v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); | ||
| 4495 | } | ||
| 4496 | else if (bmvtype == BMV_TYPE_INTERPOLATED | twomv) { | ||
| 4497 | v->twomvbp = get_vlc2(gb, v->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1); | ||
| 4498 | } | ||
| 4499 | } | ||
| 4500 | |||
| 4501 | for (i = 0; i < 6; i++) | ||
| 4502 | v->mb_type[0][s->block_index[i]] = 0; | ||
| 4503 | fieldtx = v->fieldtx_plane[mb_pos] = ff_vc1_mbmode_intfrp[0][idx_mbmode][1]; | ||
| 4504 | /* for all motion vector read MVDATA and motion compensate each block */ | ||
| 4505 | dst_idx = 0; | ||
| 4506 | if (direct) { | ||
| 4507 | if (twomv) { | ||
| 4508 | for (i = 0; i < 4; i++) { | ||
| 4509 | vc1_mc_4mv_luma(v, i, 0, 0); | ||
| 4510 | vc1_mc_4mv_luma(v, i, 1, 1); | ||
| 4511 | } | ||
| 4512 | vc1_mc_4mv_chroma4(v); | ||
| 4513 | } else { | ||
| 4514 | vc1_mc_1mv(v, 0); | ||
| 4515 | vc1_interp_mc(v); | ||
| 4516 | } | ||
| 4517 | } else if (twomv && bmvtype == BMV_TYPE_INTERPOLATED) { | ||
| 4518 | mvbp = v->fourmvbp; | ||
| 4519 | for (i = 0; i < 4; i++) { | ||
| 4520 | dir = i==1 || i==3; | ||
| 4521 | dmv_x = dmv_y = 0; | ||
| 4522 | val = ((mvbp >> (3 - i)) & 1); | ||
| 4523 | if (val) { | ||
| 4524 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | ||
| 4525 | } | ||
| 4526 | j = i > 1 ? 2 : 0; | ||
| 4527 | vc1_pred_mv_intfr(v, j, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir); | ||
| 4528 | vc1_mc_4mv_luma(v, j, dir, dir); | ||
| 4529 | vc1_mc_4mv_luma(v, j+1, dir, dir); | ||
| 4530 | } | ||
| 4531 | |||
| 4532 | vc1_mc_4mv_chroma4(v); | ||
| 4533 | } else if (bmvtype == BMV_TYPE_INTERPOLATED) { | ||
| 4534 | mvbp = v->twomvbp; | ||
| 4535 | dmv_x = dmv_y = 0; | ||
| 4536 | if (mvbp & 2) { | ||
| 4537 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | ||
| 4538 | } | ||
| 4539 | |||
| 4540 | vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0); | ||
| 4541 | vc1_mc_1mv(v, 0); | ||
| 4542 | |||
| 4543 | dmv_x = dmv_y = 0; | ||
| 4544 | if (mvbp & 1) { | ||
| 4545 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | ||
| 4546 | } | ||
| 4547 | |||
| 4548 | vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 1); | ||
| 4549 | vc1_interp_mc(v); | ||
| 4550 | } else if (twomv) { | ||
| 4551 | dir = bmvtype == BMV_TYPE_BACKWARD; | ||
| 4552 | dir2 = dir; | ||
| 4553 | if (mvsw) | ||
| 4554 | dir2 = !dir; | ||
| 4555 | mvbp = v->twomvbp; | ||
| 4556 | dmv_x = dmv_y = 0; | ||
| 4557 | if (mvbp & 2) { | ||
| 4558 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | ||
| 4559 | } | ||
| 4560 | vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir); | ||
| 4561 | |||
| 4562 | dmv_x = dmv_y = 0; | ||
| 4563 | if (mvbp & 1) { | ||
| 4564 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | ||
| 4565 | } | ||
| 4566 | vc1_pred_mv_intfr(v, 2, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], dir2); | ||
| 4567 | |||
| 4568 | if (mvsw) { | ||
| 4569 | for (i = 0; i<2; i++) { | ||
| 4570 | s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0]; | ||
| 4571 | s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1]; | ||
| 4572 | s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0]; | ||
| 4573 | s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1]; | ||
| 4574 | } | ||
| 4575 | } else { | ||
| 4576 | vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, v->mb_type[0], !dir); | ||
| 4577 | vc1_pred_mv_intfr(v, 2, 0, 0, 2, v->range_x, v->range_y, v->mb_type[0], !dir); | ||
| 4578 | } | ||
| 4579 | |||
| 4580 | vc1_mc_4mv_luma(v, 0, dir, 0); | ||
| 4581 | vc1_mc_4mv_luma(v, 1, dir, 0); | ||
| 4582 | vc1_mc_4mv_luma(v, 2, dir2, 0); | ||
| 4583 | vc1_mc_4mv_luma(v, 3, dir2, 0); | ||
| 4584 | vc1_mc_4mv_chroma4(v); | ||
| 4585 | } else { | ||
| 4586 | dir = bmvtype == BMV_TYPE_BACKWARD; | ||
| 4587 | |||
| 4588 | mvbp = ff_vc1_mbmode_intfrp[0][idx_mbmode][2]; | ||
| 4589 | dmv_x = dmv_y = 0; | ||
| 4590 | if (mvbp) { | ||
| 4591 | get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); | ||
| 4592 | } | ||
| 4593 | |||
| 4594 | vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], dir); | ||
| 4595 | v->blk_mv_type[s->block_index[0]] = 1; | ||
| 4596 | v->blk_mv_type[s->block_index[1]] = 1; | ||
| 4597 | v->blk_mv_type[s->block_index[2]] = 1; | ||
| 4598 | v->blk_mv_type[s->block_index[3]] = 1; | ||
| 4599 | vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, 0, !dir); | ||
| 4600 | for (i = 0; i<2; i++) { | ||
| 4601 | s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0]; | ||
| 4602 | s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1]; | ||
| 4603 | } | ||
| 4604 | vc1_mc_1mv(v, dir); | ||
| 4605 | } | ||
| 4606 | |||
| 4607 | if (cbp) | ||
| 4608 | GET_MQUANT(); // p. 227 | ||
| 4609 | s->current_picture.qscale_table[mb_pos] = mquant; | ||
| 4610 | if (!v->ttmbf && cbp) | ||
| 4611 | ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); | ||
| 4612 | for (i = 0; i < 6; i++) { | ||
| 4613 | s->dc_val[0][s->block_index[i]] = 0; | ||
| 4614 | dst_idx += i >> 2; | ||
| 4615 | val = ((cbp >> (5 - i)) & 1); | ||
| 4616 | if (!fieldtx) | ||
| 4617 | off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); | ||
| 4618 | else | ||
| 4619 | off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize)); | ||
| 4620 | if (val) { | ||
| 4621 | pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | ||
| 4622 | first_block, s->dest[dst_idx] + off, | ||
| 4623 | (i & 4) ? s->uvlinesize : (s->linesize << fieldtx), | ||
| 4624 | (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); | ||
| 4625 | block_cbp |= pat << (i << 2); | ||
| 4626 | if (!v->ttmbf && ttmb < 8) | ||
| 4627 | ttmb = -1; | ||
| 4628 | first_block = 0; | ||
| 4629 | } | ||
| 4630 | } | ||
| 4631 | |||
| 4632 | } else { // skipped | ||
| 4633 | dir = 0; | ||
| 4634 | for (i = 0; i < 6; i++) { | ||
| 4635 | v->mb_type[0][s->block_index[i]] = 0; | ||
| 4636 | s->dc_val[0][s->block_index[i]] = 0; | ||
| 4637 | } | ||
| 4638 | s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; | ||
| 4639 | s->current_picture.qscale_table[mb_pos] = 0; | ||
| 4640 | v->blk_mv_type[s->block_index[0]] = 0; | ||
| 4641 | v->blk_mv_type[s->block_index[1]] = 0; | ||
| 4642 | v->blk_mv_type[s->block_index[2]] = 0; | ||
| 4643 | v->blk_mv_type[s->block_index[3]] = 0; | ||
| 4644 | |||
| 4645 | if (!direct) { | ||
| 4646 | if (bmvtype == BMV_TYPE_INTERPOLATED) { | ||
| 4647 | vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0); | ||
| 4648 | vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 1); | ||
| 4649 | } else { | ||
| 4650 | dir = bmvtype == BMV_TYPE_BACKWARD; | ||
| 4651 | vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], dir); | ||
| 4652 | if (mvsw) { | ||
| 4653 | int dir2 = dir; | ||
| 4654 | if (mvsw) | ||
| 4655 | dir2 = !dir; | ||
| 4656 | for (i = 0; i<2; i++) { | ||
| 4657 | s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0]; | ||
| 4658 | s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1]; | ||
| 4659 | s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0]; | ||
| 4660 | s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1]; | ||
| 4661 | } | ||
| 4662 | } else { | ||
| 4663 | v->blk_mv_type[s->block_index[0]] = 1; | ||
| 4664 | v->blk_mv_type[s->block_index[1]] = 1; | ||
| 4665 | v->blk_mv_type[s->block_index[2]] = 1; | ||
| 4666 | v->blk_mv_type[s->block_index[3]] = 1; | ||
| 4667 | vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, 0, !dir); | ||
| 4668 | for (i = 0; i<2; i++) { | ||
| 4669 | s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0]; | ||
| 4670 | s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1]; | ||
| 4671 | } | ||
| 4672 | } | ||
| 4673 | } | ||
| 4674 | } | ||
| 4675 | |||
| 4676 | vc1_mc_1mv(v, dir); | ||
| 4677 | if (direct || bmvtype == BMV_TYPE_INTERPOLATED) { | ||
| 4678 | vc1_interp_mc(v); | ||
| 4679 | } | ||
| 4680 | } | ||
| 4681 | } | ||
| 4682 | if (s->mb_x == s->mb_width - 1) | ||
| 4683 | memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0])*s->mb_stride); | ||
| 4684 | v->cbp[s->mb_x] = block_cbp; | ||
| 4685 | v->ttblk[s->mb_x] = block_tt; | ||
| 4686 | return 0; | ||
| 4687 | } | ||
| 4688 | |||
| 4328 | /** Decode blocks of I-frame | 4689 | /** Decode blocks of I-frame |
| 4329 | */ | 4690 | */ |
| 4330 | static void vc1_decode_i_blocks(VC1Context *v) | 4691 | static void vc1_decode_i_blocks(VC1Context *v) |
| @@ -4714,6 +5075,8 @@ static void vc1_decode_b_blocks(VC1Context *v) · 383 unmodified lines | |||
| 4714 | 5075 | ||
| 4715 | if (v->fcm == ILACE_FIELD) | 5076 | if (v->fcm == ILACE_FIELD) |
| 4716 | vc1_decode_b_mb_intfi(v); | 5077 | vc1_decode_b_mb_intfi(v); |
| 5078 | else if (v->fcm == ILACE_FRAME) | ||
| 5079 | vc1_decode_b_mb_intfr(v); | ||
| 4717 | else | 5080 | else |
| 4718 | vc1_decode_b_mb(v); | 5081 | vc1_decode_b_mb(v); |
| 4719 | if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { | 5082 | if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { |
| @@ -5639,8 +6002,6 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, · 919 unmodified lines | |||
| 5639 | } else { | 6002 | } else { |
| 5640 | int header_ret = 0; | 6003 | int header_ret = 0; |
| 5641 | 6004 | ||
| 5642 | if (v->fcm == ILACE_FRAME && s->pict_type == AV_PICTURE_TYPE_B) | ||
| 5643 | goto err; // This codepath is still incomplete thus it is disabled | ||
| 5644 | 6005 | ||
| 5645 | ff_mpeg_er_frame_start(s); | 6006 | ff_mpeg_er_frame_start(s); |
| 5646 | 6007 | ||