Mercurial > libavcodec.hg
comparison msmpeg4.c @ 706:e65798d228ea libavcodec
idct permutation cleanup, idct can be selected per context now
fixing some threadunsafe code
author | michaelni |
---|---|
date | Sun, 29 Sep 2002 22:44:22 +0000 |
parents | 76e9b51cccda |
children | 4cf7173a004e |
comparison
equal
deleted
inserted
replaced
705:107a56aa74f5 | 706:e65798d228ea |
---|---|
162 s->y_dc_scale_table= wmv1_y_dc_scale_table; | 162 s->y_dc_scale_table= wmv1_y_dc_scale_table; |
163 s->c_dc_scale_table= wmv1_c_dc_scale_table; | 163 s->c_dc_scale_table= wmv1_c_dc_scale_table; |
164 break; | 164 break; |
165 } | 165 } |
166 | 166 |
167 | |
167 if(s->msmpeg4_version==4){ | 168 if(s->msmpeg4_version==4){ |
168 s->intra_scantable = wmv1_scantable[1]; | 169 int i; |
169 s->intra_h_scantable= wmv1_scantable[2]; | 170 ff_init_scantable(s, &s->intra_scantable , wmv1_scantable[1]); |
170 s->intra_v_scantable= wmv1_scantable[3]; | 171 ff_init_scantable(s, &s->intra_h_scantable, wmv1_scantable[2]); |
171 s->inter_scantable = wmv1_scantable[0]; | 172 ff_init_scantable(s, &s->intra_v_scantable, wmv1_scantable[3]); |
172 }else{ | 173 ff_init_scantable(s, &s->inter_scantable , wmv1_scantable[0]); |
173 s->intra_scantable = zigzag_direct; | 174 } |
174 s->intra_h_scantable= ff_alternate_horizontal_scan; | 175 //Note the default tables are set in common_init in mpegvideo.c |
175 s->intra_v_scantable= ff_alternate_vertical_scan; | |
176 s->inter_scantable = zigzag_direct; | |
177 } | |
178 | 176 |
179 if(!inited){ | 177 if(!inited){ |
180 int i; | 178 int i; |
181 inited=1; | 179 inited=1; |
182 | 180 |
183 init_h263_dc_for_msmpeg4(); | 181 init_h263_dc_for_msmpeg4(); |
184 | |
185 /* permute for IDCT */ | |
186 for(i=0; i<WMV1_SCANTABLE_COUNT; i++){ | |
187 int k; | |
188 for(k=0;k<64;k++) { | |
189 int j = wmv1_scantable[i][k]; | |
190 wmv1_scantable[i][k]= block_permute_op(j); | |
191 } | |
192 } | |
193 } | 182 } |
194 } | 183 } |
195 | 184 |
196 /* build the table which associate a (x,y) motion vector to a vlc */ | 185 /* build the table which associate a (x,y) motion vector to a vlc */ |
197 static void init_mv_table(MVTable *tab) | 186 static void init_mv_table(MVTable *tab) |
934 rl = &rl_table[s->rl_table_index]; | 923 rl = &rl_table[s->rl_table_index]; |
935 } else { | 924 } else { |
936 rl = &rl_table[3 + s->rl_chroma_table_index]; | 925 rl = &rl_table[3 + s->rl_chroma_table_index]; |
937 } | 926 } |
938 run_diff = 0; | 927 run_diff = 0; |
939 scantable= s->intra_scantable; | 928 scantable= s->intra_scantable.permutated; |
940 set_stat(ST_INTRA_AC); | 929 set_stat(ST_INTRA_AC); |
941 } else { | 930 } else { |
942 i = 0; | 931 i = 0; |
943 rl = &rl_table[3 + s->rl_table_index]; | 932 rl = &rl_table[3 + s->rl_table_index]; |
944 if(s->msmpeg4_version<=2) | 933 if(s->msmpeg4_version<=2) |
945 run_diff = 0; | 934 run_diff = 0; |
946 else | 935 else |
947 run_diff = 1; | 936 run_diff = 1; |
948 scantable= s->inter_scantable; | 937 scantable= s->inter_scantable.permutated; |
949 set_stat(ST_INTER_AC); | 938 set_stat(ST_INTER_AC); |
950 } | 939 } |
951 | 940 |
952 /* recalculate block_last_index for M$ wmv1 */ | 941 /* recalculate block_last_index for M$ wmv1 */ |
953 if(scantable!=zigzag_direct && s->block_last_index[n]>0){ | 942 if(s->msmpeg4_version==4 && s->block_last_index[n]>0){ |
954 for(last_index=63; last_index>=0; last_index--){ | 943 for(last_index=63; last_index>=0; last_index--){ |
955 if(block[scantable[last_index]]) break; | 944 if(block[scantable[last_index]]) break; |
956 } | 945 } |
957 }else | 946 }else |
958 last_index = s->block_last_index[n]; | 947 last_index = s->block_last_index[n]; |
1702 if (!coded) { | 1691 if (!coded) { |
1703 goto not_coded; | 1692 goto not_coded; |
1704 } | 1693 } |
1705 if (s->ac_pred) { | 1694 if (s->ac_pred) { |
1706 if (dc_pred_dir == 0) | 1695 if (dc_pred_dir == 0) |
1707 scan_table = s->intra_v_scantable; /* left */ | 1696 scan_table = s->intra_v_scantable.permutated; /* left */ |
1708 else | 1697 else |
1709 scan_table = s->intra_h_scantable; /* top */ | 1698 scan_table = s->intra_h_scantable.permutated; /* top */ |
1710 } else { | 1699 } else { |
1711 scan_table = s->intra_scantable; | 1700 scan_table = s->intra_scantable.permutated; |
1712 } | 1701 } |
1713 set_stat(ST_INTRA_AC); | 1702 set_stat(ST_INTRA_AC); |
1714 rl_vlc= rl->rl_vlc[0]; | 1703 rl_vlc= rl->rl_vlc[0]; |
1715 } else { | 1704 } else { |
1716 qmul = s->qscale << 1; | 1705 qmul = s->qscale << 1; |
1725 | 1714 |
1726 if (!coded) { | 1715 if (!coded) { |
1727 s->block_last_index[n] = i; | 1716 s->block_last_index[n] = i; |
1728 return 0; | 1717 return 0; |
1729 } | 1718 } |
1730 scan_table = s->inter_scantable; | 1719 scan_table = s->inter_scantable.permutated; |
1731 set_stat(ST_INTER_AC); | 1720 set_stat(ST_INTER_AC); |
1732 rl_vlc= rl->rl_vlc[s->qscale]; | 1721 rl_vlc= rl->rl_vlc[s->qscale]; |
1733 } | 1722 } |
1734 { | 1723 { |
1735 OPEN_READER(re, &s->gb); | 1724 OPEN_READER(re, &s->gb); |