Mercurial > libavcodec.hg
annotate i386/mpegvideo_mmx_template.c @ 3088:03582724f3de libavcodec
Correct the relation between floors of type 0 and block sizes.
author | al |
---|---|
date | Sun, 05 Feb 2006 10:16:20 +0000 |
parents | 0b546eab515d |
children | 072dbc669253 |
rev | line source |
---|---|
220 | 1 /* |
429 | 2 * MPEG video MMX templates |
3 * | |
4 * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at> | |
5 * | |
6 * This library is free software; you can redistribute it and/or | |
7 * modify it under the terms of the GNU Lesser General Public | |
8 * License as published by the Free Software Foundation; either | |
9 * version 2 of the License, or (at your option) any later version. | |
10 * | |
11 * This library is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * Lesser General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU Lesser General Public | |
17 * License along with this library; if not, write to the Free Software | |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2979
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
429 | 19 */ |
220 | 20 #undef SPREADW |
21 #undef PMAXW | |
22 #ifdef HAVE_MMX2 | |
23 #define SPREADW(a) "pshufw $0, " #a ", " #a " \n\t" | |
2979 | 24 #define PMAXW(a,b) "pmaxsw " #a ", " #b " \n\t" |
2892
41315d0120b3
replace a few mov + psrlq with pshufw, there are more cases which could benefit from this but they would require us to duplicate some functions ...
michael
parents:
2327
diff
changeset
|
25 #define PMAX(a,b) \ |
2979 | 26 "pshufw $0x0E," #a ", " #b " \n\t"\ |
27 PMAXW(b, a)\ | |
28 "pshufw $0x01," #a ", " #b " \n\t"\ | |
29 PMAXW(b, a) | |
220 | 30 #else |
31 #define SPREADW(a) \ | |
2979 | 32 "punpcklwd " #a ", " #a " \n\t"\ |
33 "punpcklwd " #a ", " #a " \n\t" | |
220 | 34 #define PMAXW(a,b) \ |
2979 | 35 "psubusw " #a ", " #b " \n\t"\ |
36 "paddw " #a ", " #b " \n\t" | |
2892
41315d0120b3
replace a few mov + psrlq with pshufw, there are more cases which could benefit from this but they would require us to duplicate some functions ...
michael
parents:
2327
diff
changeset
|
37 #define PMAX(a,b) \ |
2979 | 38 "movq " #a ", " #b " \n\t"\ |
39 "psrlq $32, " #a " \n\t"\ | |
40 PMAXW(b, a)\ | |
41 "movq " #a ", " #b " \n\t"\ | |
42 "psrlq $16, " #a " \n\t"\ | |
43 PMAXW(b, a) | |
2892
41315d0120b3
replace a few mov + psrlq with pshufw, there are more cases which could benefit from this but they would require us to duplicate some functions ...
michael
parents:
2327
diff
changeset
|
44 |
220 | 45 #endif |
46 | |
47 static int RENAME(dct_quantize)(MpegEncContext *s, | |
48 DCTELEM *block, int n, | |
344 | 49 int qscale, int *overflow) |
220 | 50 { |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2115
diff
changeset
|
51 long last_non_zero_p1; |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2115
diff
changeset
|
52 int level=0, q; //=0 is cuz gcc says uninitalized ... |
1064 | 53 const uint16_t *qmat, *bias; |
1403
bd42cc06ceb7
fixing thread safety, this may cause alignment problms (if it does than the stuff should be moved to MpegEncContext)
michaelni
parents:
1251
diff
changeset
|
54 __align8 int16_t temp_block[64]; |
2967 | 55 |
1403
bd42cc06ceb7
fixing thread safety, this may cause alignment problms (if it does than the stuff should be moved to MpegEncContext)
michaelni
parents:
1251
diff
changeset
|
56 assert((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly? |
220 | 57 |
625
bb6a69f9d409
slow but accurate integer dct from IJG (should be ok with the LGPL as the old DCT is the fast integer DCT from IJG)
michaelni
parents:
599
diff
changeset
|
58 //s->fdct (block); |
1565 | 59 RENAMEl(ff_fdct) (block); //cant be anything else ... |
344 | 60 |
1597 | 61 if(s->dct_error_sum) |
1719 | 62 s->denoise_dct(s, block); |
1597 | 63 |
220 | 64 if (s->mb_intra) { |
65 int dummy; | |
66 if (n < 4) | |
641
eaa9ef2e2557
fixing encoding at high QPs (was broken after the dct accuracy increase due to too small inverse table)
michaelni
parents:
635
diff
changeset
|
67 q = s->y_dc_scale; |
220 | 68 else |
641
eaa9ef2e2557
fixing encoding at high QPs (was broken after the dct accuracy increase due to too small inverse table)
michaelni
parents:
635
diff
changeset
|
69 q = s->c_dc_scale; |
220 | 70 /* note: block[0] is assumed to be positive */ |
350
6ebbecc10063
- Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents:
344
diff
changeset
|
71 if (!s->h263_aic) { |
220 | 72 #if 1 |
344 | 73 asm volatile ( |
2979 | 74 "mul %%ecx \n\t" |
75 : "=d" (level), "=a"(dummy) | |
76 : "a" ((block[0]>>2) + q), "c" (inverse[q<<1]) | |
344 | 77 ); |
220 | 78 #else |
344 | 79 asm volatile ( |
2979 | 80 "xorl %%edx, %%edx \n\t" |
81 "divw %%cx \n\t" | |
82 "movzwl %%ax, %%eax \n\t" | |
83 : "=a" (level) | |
84 : "a" ((block[0]>>2) + q), "c" (q<<1) | |
85 : "%edx" | |
344 | 86 ); |
220 | 87 #endif |
350
6ebbecc10063
- Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents:
344
diff
changeset
|
88 } else |
6ebbecc10063
- Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents:
344
diff
changeset
|
89 /* For AIC we skip quant/dequant of INTRADC */ |
641
eaa9ef2e2557
fixing encoding at high QPs (was broken after the dct accuracy increase due to too small inverse table)
michaelni
parents:
635
diff
changeset
|
90 level = (block[0] + 4)>>3; |
2967 | 91 |
344 | 92 block[0]=0; //avoid fake overflow |
220 | 93 // temp_block[0] = (block[0] + (q >> 1)) / q; |
94 last_non_zero_p1 = 1; | |
1554
d736e24bf303
move mmx quantizer matrixes out of MpegEncContext (23k -> 7k) (no meassureable slowdown)
michael
parents:
1403
diff
changeset
|
95 bias = s->q_intra_matrix16[qscale][1]; |
d736e24bf303
move mmx quantizer matrixes out of MpegEncContext (23k -> 7k) (no meassureable slowdown)
michael
parents:
1403
diff
changeset
|
96 qmat = s->q_intra_matrix16[qscale][0]; |
220 | 97 } else { |
98 last_non_zero_p1 = 0; | |
1554
d736e24bf303
move mmx quantizer matrixes out of MpegEncContext (23k -> 7k) (no meassureable slowdown)
michael
parents:
1403
diff
changeset
|
99 bias = s->q_inter_matrix16[qscale][1]; |
d736e24bf303
move mmx quantizer matrixes out of MpegEncContext (23k -> 7k) (no meassureable slowdown)
michael
parents:
1403
diff
changeset
|
100 qmat = s->q_inter_matrix16[qscale][0]; |
220 | 101 } |
102 | |
2327
5e5cf598a48b
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
2293
diff
changeset
|
103 if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){ |
2967 | 104 |
344 | 105 asm volatile( |
2979 | 106 "movd %%"REG_a", %%mm3 \n\t" // last_non_zero_p1 |
344 | 107 SPREADW(%%mm3) |
2979 | 108 "pxor %%mm7, %%mm7 \n\t" // 0 |
109 "pxor %%mm4, %%mm4 \n\t" // 0 | |
110 "movq (%2), %%mm5 \n\t" // qmat[0] | |
111 "pxor %%mm6, %%mm6 \n\t" | |
112 "psubw (%3), %%mm6 \n\t" // -bias[0] | |
113 "mov $-128, %%"REG_a" \n\t" | |
114 ".balign 16 \n\t" | |
115 "1: \n\t" | |
116 "pxor %%mm1, %%mm1 \n\t" // 0 | |
117 "movq (%1, %%"REG_a"), %%mm0 \n\t" // block[i] | |
118 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 | |
119 "pxor %%mm1, %%mm0 \n\t" | |
120 "psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) | |
121 "psubusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] | |
122 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16 | |
123 "por %%mm0, %%mm4 \n\t" | |
124 "pxor %%mm1, %%mm0 \n\t" | |
125 "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) | |
126 "movq %%mm0, (%5, %%"REG_a") \n\t" | |
127 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 | |
128 "movq (%4, %%"REG_a"), %%mm1 \n\t" | |
129 "movq %%mm7, (%1, %%"REG_a") \n\t" // 0 | |
130 "pandn %%mm1, %%mm0 \n\t" | |
131 PMAXW(%%mm0, %%mm3) | |
132 "add $8, %%"REG_a" \n\t" | |
133 " js 1b \n\t" | |
134 PMAX(%%mm3, %%mm0) | |
135 "movd %%mm3, %%"REG_a" \n\t" | |
136 "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1 | |
137 : "+a" (last_non_zero_p1) | |
1251 | 138 : "r" (block+64), "r" (qmat), "r" (bias), |
344 | 139 "r" (inv_zigzag_direct16+64), "r" (temp_block+64) |
140 ); | |
141 // note the asm is split cuz gcc doesnt like that many operands ... | |
142 asm volatile( | |
2979 | 143 "movd %1, %%mm1 \n\t" // max_qcoeff |
144 SPREADW(%%mm1) | |
145 "psubusw %%mm1, %%mm4 \n\t" | |
146 "packuswb %%mm4, %%mm4 \n\t" | |
147 "movd %%mm4, %0 \n\t" // *overflow | |
1251 | 148 : "=g" (*overflow) |
149 : "g" (s->max_qcoeff) | |
150 ); | |
151 }else{ // FMT_H263 | |
152 asm volatile( | |
2979 | 153 "movd %%"REG_a", %%mm3 \n\t" // last_non_zero_p1 |
1251 | 154 SPREADW(%%mm3) |
2979 | 155 "pxor %%mm7, %%mm7 \n\t" // 0 |
156 "pxor %%mm4, %%mm4 \n\t" // 0 | |
157 "mov $-128, %%"REG_a" \n\t" | |
158 ".balign 16 \n\t" | |
159 "1: \n\t" | |
160 "pxor %%mm1, %%mm1 \n\t" // 0 | |
161 "movq (%1, %%"REG_a"), %%mm0 \n\t" // block[i] | |
162 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 | |
163 "pxor %%mm1, %%mm0 \n\t" | |
164 "psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) | |
165 "movq (%3, %%"REG_a"), %%mm6 \n\t" // bias[0] | |
166 "paddusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] | |
167 "movq (%2, %%"REG_a"), %%mm5 \n\t" // qmat[i] | |
168 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16 | |
169 "por %%mm0, %%mm4 \n\t" | |
170 "pxor %%mm1, %%mm0 \n\t" | |
171 "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) | |
172 "movq %%mm0, (%5, %%"REG_a") \n\t" | |
173 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 | |
174 "movq (%4, %%"REG_a"), %%mm1 \n\t" | |
175 "movq %%mm7, (%1, %%"REG_a") \n\t" // 0 | |
176 "pandn %%mm1, %%mm0 \n\t" | |
177 PMAXW(%%mm0, %%mm3) | |
178 "add $8, %%"REG_a" \n\t" | |
179 " js 1b \n\t" | |
180 PMAX(%%mm3, %%mm0) | |
181 "movd %%mm3, %%"REG_a" \n\t" | |
182 "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1 | |
183 : "+a" (last_non_zero_p1) | |
1251 | 184 : "r" (block+64), "r" (qmat+64), "r" (bias+64), |
185 "r" (inv_zigzag_direct16+64), "r" (temp_block+64) | |
186 ); | |
187 // note the asm is split cuz gcc doesnt like that many operands ... | |
188 asm volatile( | |
2979 | 189 "movd %1, %%mm1 \n\t" // max_qcoeff |
190 SPREADW(%%mm1) | |
191 "psubusw %%mm1, %%mm4 \n\t" | |
192 "packuswb %%mm4, %%mm4 \n\t" | |
193 "movd %%mm4, %0 \n\t" // *overflow | |
1251 | 194 : "=g" (*overflow) |
195 : "g" (s->max_qcoeff) | |
344 | 196 ); |
197 } | |
198 | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
199 if(s->mb_intra) block[0]= level; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
200 else block[0]= temp_block[0]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
201 |
1092 | 202 if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
203 if(last_non_zero_p1 <= 1) goto end; |
2967 | 204 block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; |
205 block[0x20] = temp_block[0x10]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
206 if(last_non_zero_p1 <= 4) goto end; |
2967 | 207 block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; |
208 block[0x09] = temp_block[0x03]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
209 if(last_non_zero_p1 <= 7) goto end; |
2967 | 210 block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; |
211 block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
212 if(last_non_zero_p1 <= 11) goto end; |
2967 | 213 block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; |
214 block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; | |
215 block[0x0C] = temp_block[0x05]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
216 if(last_non_zero_p1 <= 16) goto end; |
2967 | 217 block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; |
218 block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; | |
219 block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; | |
220 block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
221 if(last_non_zero_p1 <= 24) goto end; |
2967 | 222 block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; |
223 block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; | |
224 block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; | |
225 block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
226 if(last_non_zero_p1 <= 32) goto end; |
2967 | 227 block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; |
228 block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; | |
229 block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; | |
230 block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
231 if(last_non_zero_p1 <= 40) goto end; |
2967 | 232 block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; |
233 block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; | |
234 block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; | |
235 block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
236 if(last_non_zero_p1 <= 48) goto end; |
2967 | 237 block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; |
238 block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; | |
239 block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; | |
240 block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
241 if(last_non_zero_p1 <= 56) goto end; |
2967 | 242 block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; |
243 block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; | |
244 block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
245 block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; |
1092 | 246 }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
247 if(last_non_zero_p1 <= 1) goto end; |
2967 | 248 block[0x04] = temp_block[0x01]; |
249 block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
250 if(last_non_zero_p1 <= 4) goto end; |
2967 | 251 block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; |
252 block[0x05] = temp_block[0x03]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
253 if(last_non_zero_p1 <= 7) goto end; |
2967 | 254 block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; |
255 block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
256 if(last_non_zero_p1 <= 11) goto end; |
2967 | 257 block[0x1C] = temp_block[0x19]; |
258 block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; | |
259 block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
260 if(last_non_zero_p1 <= 16) goto end; |
2967 | 261 block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; |
262 block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; | |
263 block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; | |
264 block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
265 if(last_non_zero_p1 <= 24) goto end; |
2967 | 266 block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; |
267 block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; | |
268 block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; | |
269 block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
270 if(last_non_zero_p1 <= 32) goto end; |
2967 | 271 block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; |
272 block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; | |
273 block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; | |
274 block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
275 if(last_non_zero_p1 <= 40) goto end; |
2967 | 276 block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; |
277 block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; | |
278 block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; | |
279 block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
280 if(last_non_zero_p1 <= 48) goto end; |
2967 | 281 block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; |
282 block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; | |
283 block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; | |
284 block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
285 if(last_non_zero_p1 <= 56) goto end; |
2967 | 286 block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; |
287 block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; | |
288 block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
289 block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
290 }else{ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
291 if(last_non_zero_p1 <= 1) goto end; |
2967 | 292 block[0x01] = temp_block[0x01]; |
293 block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
294 if(last_non_zero_p1 <= 4) goto end; |
2967 | 295 block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; |
296 block[0x03] = temp_block[0x03]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
297 if(last_non_zero_p1 <= 7) goto end; |
2967 | 298 block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; |
299 block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
300 if(last_non_zero_p1 <= 11) goto end; |
2967 | 301 block[0x19] = temp_block[0x19]; |
302 block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; | |
303 block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
304 if(last_non_zero_p1 <= 16) goto end; |
2967 | 305 block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; |
306 block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; | |
307 block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; | |
308 block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
309 if(last_non_zero_p1 <= 24) goto end; |
2967 | 310 block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; |
311 block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; | |
312 block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; | |
313 block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
314 if(last_non_zero_p1 <= 32) goto end; |
2967 | 315 block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; |
316 block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; | |
317 block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; | |
318 block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
319 if(last_non_zero_p1 <= 40) goto end; |
2967 | 320 block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; |
321 block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; | |
322 block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; | |
323 block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
324 if(last_non_zero_p1 <= 48) goto end; |
2967 | 325 block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; |
326 block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; | |
327 block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; | |
328 block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
329 if(last_non_zero_p1 <= 56) goto end; |
2967 | 330 block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; |
331 block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; | |
332 block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
333 block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
334 } |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
335 end: |
220 | 336 /* |
337 for(i=0; i<last_non_zero_p1; i++) | |
338 { | |
339 int j= zigzag_direct_noperm[i]; | |
340 block[block_permute_op(j)]= temp_block[j]; | |
341 } | |
342 */ | |
344 | 343 |
220 | 344 return last_non_zero_p1 - 1; |
345 } |