Revision 2739dc5d libavcodec/vc1dec.c
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; 
Also available in: Unified diff