Mercurial > libavcodec.hg
comparison msmpeg4.c @ 563:61442627f857 libavcodec
fixes fire.avi & subtitles.avi
author | michaelni |
---|---|
date | Wed, 17 Jul 2002 09:15:14 +0000 |
parents | 762c67fd4078 |
children | 32c142b10263 |
comparison
equal
deleted
inserted
replaced
562:23e58889a108 | 563:61442627f857 |
---|---|
1623 } | 1623 } |
1624 } | 1624 } |
1625 | 1625 |
1626 return 0; | 1626 return 0; |
1627 } | 1627 } |
1628 | 1628 //#define ERROR_DETAILS |
1629 static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, | 1629 static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, |
1630 int n, int coded) | 1630 int n, int coded) |
1631 { | 1631 { |
1632 int level, i, last, run, run_diff; | 1632 int level, i, last, run, run_diff; |
1633 int dc_pred_dir; | 1633 int dc_pred_dir; |
1790 return DECODING_AC_LOST; | 1790 return DECODING_AC_LOST; |
1791 } | 1791 } |
1792 #endif | 1792 #endif |
1793 i+= run + 1; | 1793 i+= run + 1; |
1794 if(last) i+=192; | 1794 if(last) i+=192; |
1795 #ifdef ERROR_DETAILS | |
1796 if(run==66) | |
1797 fprintf(stderr, "illegal vlc code in ESC3 level=%d\n", level); | |
1798 else if((i>62 && i<192) || i>192+63) | |
1799 fprintf(stderr, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level); | |
1800 #endif | |
1795 } else { | 1801 } else { |
1796 /* second escape */ | 1802 /* second escape */ |
1797 #if MIN_CACHE_BITS < 23 | 1803 #if MIN_CACHE_BITS < 23 |
1798 LAST_SKIP_BITS(re, &s->gb, 2); | 1804 LAST_SKIP_BITS(re, &s->gb, 2); |
1799 UPDATE_CACHE(re, &s->gb); | 1805 UPDATE_CACHE(re, &s->gb); |
1802 #endif | 1808 #endif |
1803 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); | 1809 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); |
1804 i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing | 1810 i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing |
1805 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 1811 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); |
1806 LAST_SKIP_BITS(re, &s->gb, 1); | 1812 LAST_SKIP_BITS(re, &s->gb, 1); |
1813 #ifdef ERROR_DETAILS | |
1814 if(run==66) | |
1815 fprintf(stderr, "illegal vlc code in ESC2 level=%d\n", level); | |
1816 else if((i>62 && i<192) || i>192+63) | |
1817 fprintf(stderr, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level); | |
1818 #endif | |
1807 } | 1819 } |
1808 } else { | 1820 } else { |
1809 /* first escape */ | 1821 /* first escape */ |
1810 #if MIN_CACHE_BITS < 22 | 1822 #if MIN_CACHE_BITS < 22 |
1811 LAST_SKIP_BITS(re, &s->gb, 1); | 1823 LAST_SKIP_BITS(re, &s->gb, 1); |
1816 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); | 1828 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); |
1817 i+= run; | 1829 i+= run; |
1818 level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing | 1830 level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing |
1819 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 1831 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); |
1820 LAST_SKIP_BITS(re, &s->gb, 1); | 1832 LAST_SKIP_BITS(re, &s->gb, 1); |
1833 #ifdef ERROR_DETAILS | |
1834 if(run==66) | |
1835 fprintf(stderr, "illegal vlc code in ESC1 level=%d\n", level); | |
1836 else if((i>62 && i<192) || i>192+63) | |
1837 fprintf(stderr, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level); | |
1838 #endif | |
1821 } | 1839 } |
1822 } else { | 1840 } else { |
1823 i+= run; | 1841 i+= run; |
1824 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); | 1842 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); |
1825 LAST_SKIP_BITS(re, &s->gb, 1); | 1843 LAST_SKIP_BITS(re, &s->gb, 1); |
1844 #ifdef ERROR_DETAILS | |
1845 if(run==66) | |
1846 fprintf(stderr, "illegal vlc code level=%d\n", level); | |
1847 else if((i>62 && i<192) || i>192+63) | |
1848 fprintf(stderr, "run overflow i=%d run=%d level=%d\n", i, run, level); | |
1849 #endif | |
1826 } | 1850 } |
1827 if (i > 62){ | 1851 if (i > 62){ |
1828 i-= 192; | 1852 i-= 192; |
1829 if(i&(~63)){ | 1853 if(i&(~63)){ |
1830 fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); | 1854 if(i+192 == 64 && level/qmul==-1){ |
1831 return -1; | 1855 fprintf(stderr, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y); |
1856 break; | |
1857 }else{ | |
1858 fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); | |
1859 return -1; | |
1860 } | |
1832 } | 1861 } |
1833 | 1862 |
1834 block[scan_table[i]] = level; | 1863 block[scan_table[i]] = level; |
1835 break; | 1864 break; |
1836 } | 1865 } |