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