Revision 1da6ea39

View differences:

libavcodec/ppc/vc1dsp_altivec.c
154 154
    src6 = vec_ld( 96, block);
155 155
    src7 = vec_ld(112, block);
156 156

  
157
    TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7);
158 157
    s0 = vec_unpackl(src0);
159 158
    s1 = vec_unpackl(src1);
160 159
    s2 = vec_unpackl(src2);
libavcodec/vc1.h
215 215
    int k_y;              ///< Number of bits for MVs (depends on MV range)
216 216
    int range_x, range_y; ///< MV range
217 217
    uint8_t pq, altpq;    ///< Current/alternate frame quantizer scale
218
    uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT
218 219
    const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode
219 220
    const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode
220 221
    /** pquant parameters */
libavcodec/vc1dec.c
1499 1499

  
1500 1500
        if(v->s.ac_pred) {
1501 1501
            if(!dc_pred_dir)
1502
                zz_table = wmv1_scantable[2];
1502
                zz_table = v->zz_8x8[2];
1503 1503
            else
1504
                zz_table = wmv1_scantable[3];
1504
                zz_table = v->zz_8x8[3];
1505 1505
        } else
1506
            zz_table = wmv1_scantable[1];
1506
            zz_table = v->zz_8x8[1];
1507 1507

  
1508 1508
        ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
1509 1509
        ac_val2 = ac_val;
......
1524 1524
        if(s->ac_pred) {
1525 1525
            if(dc_pred_dir) { //left
1526 1526
                for(k = 1; k < 8; k++)
1527
                    block[k << 3] += ac_val[k];
1527
                    block[k] += ac_val[k];
1528 1528
            } else { //top
1529 1529
                for(k = 1; k < 8; k++)
1530
                    block[k] += ac_val[k + 8];
1530
                    block[k << 3] += ac_val[k + 8];
1531 1531
            }
1532 1532
        }
1533 1533
        /* save AC coeffs for further prediction */
1534 1534
        for(k = 1; k < 8; k++) {
1535
            ac_val2[k] = block[k << 3];
1536
            ac_val2[k + 8] = block[k];
1535
            ac_val2[k] = block[k];
1536
            ac_val2[k + 8] = block[k << 3];
1537 1537
        }
1538 1538

  
1539 1539
        /* scale AC coeffs */
......
1570 1570
        if(s->ac_pred) {
1571 1571
            if(dc_pred_dir) { //left
1572 1572
                for(k = 1; k < 8; k++) {
1573
                    block[k << 3] = ac_val[k] * scale;
1574
                    if(!v->pquantizer && block[k << 3])
1575
                        block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq;
1573
                    block[k] = ac_val[k] * scale;
1574
                    if(!v->pquantizer && block[k])
1575
                        block[k] += (block[k] < 0) ? -v->pq : v->pq;
1576 1576
                }
1577 1577
            } else { //top
1578 1578
                for(k = 1; k < 8; k++) {
1579
                    block[k] = ac_val[k + 8] * scale;
1580
                    if(!v->pquantizer && block[k])
1581
                        block[k] += (block[k] < 0) ? -v->pq : v->pq;
1579
                    block[k << 3] = ac_val[k + 8] * scale;
1580
                    if(!v->pquantizer && block[k << 3])
1581
                        block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq;
1582 1582
                }
1583 1583
            }
1584 1584
            i = 63;
......
1682 1682

  
1683 1683
        if(v->s.ac_pred) {
1684 1684
            if(!dc_pred_dir)
1685
                zz_table = wmv1_scantable[2];
1685
                zz_table = v->zz_8x8[2];
1686 1686
            else
1687
                zz_table = wmv1_scantable[3];
1687
                zz_table = v->zz_8x8[3];
1688 1688
        } else
1689
            zz_table = wmv1_scantable[1];
1689
            zz_table = v->zz_8x8[1];
1690 1690

  
1691 1691
        while (!last) {
1692 1692
            vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
......
1705 1705

  
1706 1706
                if(dc_pred_dir) { //left
1707 1707
                    for(k = 1; k < 8; k++)
1708
                        block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
1708
                        block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
1709 1709
                } else { //top
1710 1710
                    for(k = 1; k < 8; k++)
1711
                        block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
1711
                        block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
1712 1712
                }
1713 1713
            } else {
1714 1714
                if(dc_pred_dir) { //left
1715 1715
                    for(k = 1; k < 8; k++)
1716
                        block[k << 3] += ac_val[k];
1716
                        block[k] += ac_val[k];
1717 1717
                } else { //top
1718 1718
                    for(k = 1; k < 8; k++)
1719
                        block[k] += ac_val[k + 8];
1719
                        block[k << 3] += ac_val[k + 8];
1720 1720
                }
1721 1721
            }
1722 1722
        }
1723 1723
        /* save AC coeffs for further prediction */
1724 1724
        for(k = 1; k < 8; k++) {
1725
            ac_val2[k] = block[k << 3];
1726
            ac_val2[k + 8] = block[k];
1725
            ac_val2[k] = block[k];
1726
            ac_val2[k + 8] = block[k << 3];
1727 1727
        }
1728 1728

  
1729 1729
        /* scale AC coeffs */
......
1765 1765
        if(use_pred) {
1766 1766
            if(dc_pred_dir) { //left
1767 1767
                for(k = 1; k < 8; k++) {
1768
                    block[k << 3] = ac_val2[k] * scale;
1769
                    if(!v->pquantizer && block[k << 3])
1770
                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
1768
                    block[k] = ac_val2[k] * scale;
1769
                    if(!v->pquantizer && block[k])
1770
                        block[k] += (block[k] < 0) ? -mquant : mquant;
1771 1771
                }
1772 1772
            } else { //top
1773 1773
                for(k = 1; k < 8; k++) {
1774
                    block[k] = ac_val2[k + 8] * scale;
1775
                    if(!v->pquantizer && block[k])
1776
                        block[k] += (block[k] < 0) ? -mquant : mquant;
1774
                    block[k << 3] = ac_val2[k + 8] * scale;
1775
                    if(!v->pquantizer && block[k << 3])
1776
                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
1777 1777
                }
1778 1778
            }
1779 1779
            i = 63;
......
1884 1884

  
1885 1885
    if(coded) {
1886 1886
        int last = 0, skip, value;
1887
        const uint8_t *zz_table;
1888 1887
        int k;
1889 1888

  
1890
        zz_table = wmv1_scantable[0];
1891

  
1892 1889
        while (!last) {
1893 1890
            vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
1894 1891
            i += skip;
1895 1892
            if(i > 63)
1896 1893
                break;
1897
            block[zz_table[i++]] = value;
1894
            block[v->zz_8x8[0][i++]] = value;
1898 1895
        }
1899 1896

  
1900 1897
        /* apply AC prediction if needed */
......
1906 1903

  
1907 1904
                if(dc_pred_dir) { //left
1908 1905
                    for(k = 1; k < 8; k++)
1909
                        block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
1906
                        block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
1910 1907
                } else { //top
1911 1908
                    for(k = 1; k < 8; k++)
1912
                        block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
1909
                        block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
1913 1910
                }
1914 1911
            } else {
1915 1912
                if(dc_pred_dir) { //left
1916 1913
                    for(k = 1; k < 8; k++)
1917
                        block[k << 3] += ac_val[k];
1914
                        block[k] += ac_val[k];
1918 1915
                } else { //top
1919 1916
                    for(k = 1; k < 8; k++)
1920
                        block[k] += ac_val[k + 8];
1917
                        block[k << 3] += ac_val[k + 8];
1921 1918
                }
1922 1919
            }
1923 1920
        }
1924 1921
        /* save AC coeffs for further prediction */
1925 1922
        for(k = 1; k < 8; k++) {
1926
            ac_val2[k] = block[k << 3];
1927
            ac_val2[k + 8] = block[k];
1923
            ac_val2[k] = block[k];
1924
            ac_val2[k + 8] = block[k << 3];
1928 1925
        }
1929 1926

  
1930 1927
        /* scale AC coeffs */
......
1966 1963
        if(use_pred) {
1967 1964
            if(dc_pred_dir) { //left
1968 1965
                for(k = 1; k < 8; k++) {
1969
                    block[k << 3] = ac_val2[k] * scale;
1970
                    if(!v->pquantizer && block[k << 3])
1971
                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
1966
                    block[k] = ac_val2[k] * scale;
1967
                    if(!v->pquantizer && block[k])
1968
                        block[k] += (block[k] < 0) ? -mquant : mquant;
1972 1969
                }
1973 1970
            } else { //top
1974 1971
                for(k = 1; k < 8; k++) {
1975
                    block[k] = ac_val2[k + 8] * scale;
1976
                    if(!v->pquantizer && block[k])
1977
                        block[k] += (block[k] < 0) ? -mquant : mquant;
1972
                    block[k << 3] = ac_val2[k + 8] * scale;
1973
                    if(!v->pquantizer && block[k << 3])
1974
                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
1978 1975
                }
1979 1976
            }
1980 1977
            i = 63;
......
2035 2032
            i += skip;
2036 2033
            if(i > 63)
2037 2034
                break;
2038
            idx = wmv1_scantable[0][i++];
2035
            idx = v->zz_8x8[0][i++];
2039 2036
            block[idx] = value * scale;
2040 2037
            if(!v->pquantizer)
2041 2038
                block[idx] += (block[idx] < 0) ? -mquant : mquant;
......
3007 3004
    VC1Context *v = avctx->priv_data;
3008 3005
    MpegEncContext *s = &v->s;
3009 3006
    GetBitContext gb;
3007
    int i;
3010 3008

  
3011 3009
    if (!avctx->extradata_size || !avctx->extradata) return -1;
3012 3010
    if (!(avctx->flags & CODEC_FLAG_GRAY))
......
3025 3023
    if(ff_msmpeg4_decode_init(avctx) < 0)
3026 3024
        return -1;
3027 3025
    if (vc1_init_common(v) < 0) return -1;
3026
    for (i = 0; i < 64;  i++) {
3027
#define transpose(x) ((x>>3) | ((x&7)<<3))
3028
        v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]);
3029
        v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]);
3030
        v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]);
3031
        v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]);
3032
    }
3028 3033

  
3029 3034
    avctx->coded_width = avctx->width;
3030 3035
    avctx->coded_height = avctx->height;
libavcodec/vc1dsp.c
203 203
{
204 204
    int i;
205 205
    register int t1,t2,t3,t4,t5,t6,t7,t8;
206
    DCTELEM *src, *dst;
206
    DCTELEM *src, *dst, temp[64];
207 207

  
208 208
    src = block;
209
    dst = block;
209
    dst = temp;
210 210
    for(i = 0; i < 8; i++){
211
        t1 = 12 * (src[0] + src[4]) + 4;
212
        t2 = 12 * (src[0] - src[4]) + 4;
213
        t3 = 16 * src[2] +  6 * src[6];
214
        t4 =  6 * src[2] - 16 * src[6];
211
        t1 = 12 * (src[ 0] + src[32]) + 4;
212
        t2 = 12 * (src[ 0] - src[32]) + 4;
213
        t3 = 16 * src[16] +  6 * src[48];
214
        t4 =  6 * src[16] - 16 * src[48];
215 215

  
216 216
        t5 = t1 + t3;
217 217
        t6 = t2 + t4;
218 218
        t7 = t2 - t4;
219 219
        t8 = t1 - t3;
220 220

  
221
        t1 = 16 * src[1] + 15 * src[3] +  9 * src[5] +  4 * src[7];
222
        t2 = 15 * src[1] -  4 * src[3] - 16 * src[5] -  9 * src[7];
223
        t3 =  9 * src[1] - 16 * src[3] +  4 * src[5] + 15 * src[7];
224
        t4 =  4 * src[1] -  9 * src[3] + 15 * src[5] - 16 * src[7];
221
        t1 = 16 * src[ 8] + 15 * src[24] +  9 * src[40] +  4 * src[56];
222
        t2 = 15 * src[ 8] -  4 * src[24] - 16 * src[40] -  9 * src[56];
223
        t3 =  9 * src[ 8] - 16 * src[24] +  4 * src[40] + 15 * src[56];
224
        t4 =  4 * src[ 8] -  9 * src[24] + 15 * src[40] - 16 * src[56];
225 225

  
226 226
        dst[0] = (t5 + t1) >> 3;
227 227
        dst[1] = (t6 + t2) >> 3;
......
232 232
        dst[6] = (t6 - t2) >> 3;
233 233
        dst[7] = (t5 - t1) >> 3;
234 234

  
235
        src += 8;
235
        src += 1;
236 236
        dst += 8;
237 237
    }
238 238

  
239
    src = block;
239
    src = temp;
240 240
    dst = block;
241 241
    for(i = 0; i < 8; i++){
242 242
        t1 = 12 * (src[ 0] + src[32]) + 64;

Also available in: Unified diff