Mercurial > libavcodec.hg
annotate i386/mpegvideo_mmx_template.c @ 1515:e94e299aee40 libavcodec
optimised versions of the get_pixels, diff_pixels, and bswap_buf
functions and support for 4 pixel high blocks in the put_pixels8_xxx and
avg_pixels8_xxx functions, courtesy of Robin Kay (komadori
at gekkou.co.uk)
author | melanson |
---|---|
date | Sat, 11 Oct 2003 16:43:51 +0000 |
parents | bd42cc06ceb7 |
children | d736e24bf303 |
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 | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 */ | |
220 | 20 #undef SPREADW |
21 #undef PMAXW | |
22 #ifdef HAVE_MMX2 | |
23 #define SPREADW(a) "pshufw $0, " #a ", " #a " \n\t" | |
24 #define PMAXW(a,b) "pmaxsw " #a ", " #b " \n\t" | |
25 | |
26 #else | |
27 #define SPREADW(a) \ | |
28 "punpcklwd " #a ", " #a " \n\t"\ | |
29 "punpcklwd " #a ", " #a " \n\t" | |
30 #define PMAXW(a,b) \ | |
31 "psubusw " #a ", " #b " \n\t"\ | |
32 "paddw " #a ", " #b " \n\t" | |
33 #endif | |
34 | |
35 static int RENAME(dct_quantize)(MpegEncContext *s, | |
36 DCTELEM *block, int n, | |
344 | 37 int qscale, int *overflow) |
220 | 38 { |
344 | 39 int level=0, last_non_zero_p1, q; //=0 is cuz gcc says uninitalized ... |
1064 | 40 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
|
41 __align8 int16_t temp_block[64]; |
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
|
42 |
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
|
43 assert((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly? |
220 | 44 |
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
|
45 //s->fdct (block); |
687
9abb13c21fbe
fdct_mmx -> ff_fdct_mmx (renamed to avoid namespace conflict with xvid)
arpi_esp
parents:
641
diff
changeset
|
46 ff_fdct_mmx (block); //cant be anything else ... |
344 | 47 |
220 | 48 if (s->mb_intra) { |
49 int dummy; | |
50 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
|
51 q = s->y_dc_scale; |
220 | 52 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
|
53 q = s->c_dc_scale; |
220 | 54 /* 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
|
55 if (!s->h263_aic) { |
220 | 56 #if 1 |
344 | 57 asm volatile ( |
1013 | 58 "imul %%ecx \n\t" |
344 | 59 : "=d" (level), "=a"(dummy) |
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
|
60 : "a" ((block[0]>>2) + q), "c" (inverse[q<<1]) |
344 | 61 ); |
220 | 62 #else |
344 | 63 asm volatile ( |
64 "xorl %%edx, %%edx \n\t" | |
65 "divw %%cx \n\t" | |
66 "movzwl %%ax, %%eax \n\t" | |
67 : "=a" (level) | |
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
|
68 : "a" ((block[0]>>2) + q), "c" (q<<1) |
344 | 69 : "%edx" |
70 ); | |
220 | 71 #endif |
350
6ebbecc10063
- Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents:
344
diff
changeset
|
72 } else |
6ebbecc10063
- Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents:
344
diff
changeset
|
73 /* 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
|
74 level = (block[0] + 4)>>3; |
350
6ebbecc10063
- Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents:
344
diff
changeset
|
75 |
344 | 76 block[0]=0; //avoid fake overflow |
220 | 77 // temp_block[0] = (block[0] + (q >> 1)) / q; |
78 last_non_zero_p1 = 1; | |
344 | 79 bias = s->q_intra_matrix16_bias[qscale]; |
80 qmat = s->q_intra_matrix16[qscale]; | |
220 | 81 } else { |
82 last_non_zero_p1 = 0; | |
344 | 83 bias = s->q_inter_matrix16_bias[qscale]; |
84 qmat = s->q_inter_matrix16[qscale]; | |
220 | 85 } |
86 | |
599 | 87 if(s->out_format == FMT_H263 && s->mpeg_quant==0){ |
1251 | 88 |
344 | 89 asm volatile( |
90 "movd %%eax, %%mm3 \n\t" // last_non_zero_p1 | |
91 SPREADW(%%mm3) | |
92 "pxor %%mm7, %%mm7 \n\t" // 0 | |
93 "pxor %%mm4, %%mm4 \n\t" // 0 | |
1251 | 94 "movq (%2), %%mm5 \n\t" // qmat[0] |
344 | 95 "pxor %%mm6, %%mm6 \n\t" |
1251 | 96 "psubw (%3), %%mm6 \n\t" // -bias[0] |
344 | 97 "movl $-128, %%eax \n\t" |
98 ".balign 16 \n\t" | |
99 "1: \n\t" | |
100 "pxor %%mm1, %%mm1 \n\t" // 0 | |
101 "movq (%1, %%eax), %%mm0 \n\t" // block[i] | |
102 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 | |
103 "pxor %%mm1, %%mm0 \n\t" | |
104 "psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) | |
105 "psubusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] | |
106 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16 | |
107 "por %%mm0, %%mm4 \n\t" | |
108 "pxor %%mm1, %%mm0 \n\t" | |
109 "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) | |
1251 | 110 "movq %%mm0, (%5, %%eax) \n\t" |
344 | 111 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 |
1251 | 112 "movq (%4, %%eax), %%mm1 \n\t" |
344 | 113 "movq %%mm7, (%1, %%eax) \n\t" // 0 |
114 "pandn %%mm1, %%mm0 \n\t" | |
115 PMAXW(%%mm0, %%mm3) | |
116 "addl $8, %%eax \n\t" | |
117 " js 1b \n\t" | |
118 "movq %%mm3, %%mm0 \n\t" | |
119 "psrlq $32, %%mm3 \n\t" | |
120 PMAXW(%%mm0, %%mm3) | |
121 "movq %%mm3, %%mm0 \n\t" | |
122 "psrlq $16, %%mm3 \n\t" | |
123 PMAXW(%%mm0, %%mm3) | |
124 "movd %%mm3, %%eax \n\t" | |
125 "movzbl %%al, %%eax \n\t" // last_non_zero_p1 | |
1251 | 126 : "+a" (last_non_zero_p1) |
127 : "r" (block+64), "r" (qmat), "r" (bias), | |
344 | 128 "r" (inv_zigzag_direct16+64), "r" (temp_block+64) |
129 ); | |
130 // note the asm is split cuz gcc doesnt like that many operands ... | |
131 asm volatile( | |
132 "movd %1, %%mm1 \n\t" // max_qcoeff | |
133 SPREADW(%%mm1) | |
134 "psubusw %%mm1, %%mm4 \n\t" | |
135 "packuswb %%mm4, %%mm4 \n\t" | |
136 "movd %%mm4, %0 \n\t" // *overflow | |
1251 | 137 : "=g" (*overflow) |
138 : "g" (s->max_qcoeff) | |
139 ); | |
140 }else{ // FMT_H263 | |
141 asm volatile( | |
142 "movd %%eax, %%mm3 \n\t" // last_non_zero_p1 | |
143 SPREADW(%%mm3) | |
144 "pxor %%mm7, %%mm7 \n\t" // 0 | |
145 "pxor %%mm4, %%mm4 \n\t" // 0 | |
146 "movl $-128, %%eax \n\t" | |
147 ".balign 16 \n\t" | |
148 "1: \n\t" | |
149 "pxor %%mm1, %%mm1 \n\t" // 0 | |
150 "movq (%1, %%eax), %%mm0 \n\t" // block[i] | |
151 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 | |
152 "pxor %%mm1, %%mm0 \n\t" | |
153 "psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) | |
154 "movq (%3, %%eax), %%mm6 \n\t" // bias[0] | |
155 "paddusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] | |
156 "movq (%2, %%eax), %%mm5 \n\t" // qmat[i] | |
157 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16 | |
158 "por %%mm0, %%mm4 \n\t" | |
159 "pxor %%mm1, %%mm0 \n\t" | |
160 "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) | |
161 "movq %%mm0, (%5, %%eax) \n\t" | |
162 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 | |
163 "movq (%4, %%eax), %%mm1 \n\t" | |
164 "movq %%mm7, (%1, %%eax) \n\t" // 0 | |
165 "pandn %%mm1, %%mm0 \n\t" | |
166 PMAXW(%%mm0, %%mm3) | |
167 "addl $8, %%eax \n\t" | |
168 " js 1b \n\t" | |
169 "movq %%mm3, %%mm0 \n\t" | |
170 "psrlq $32, %%mm3 \n\t" | |
171 PMAXW(%%mm0, %%mm3) | |
172 "movq %%mm3, %%mm0 \n\t" | |
173 "psrlq $16, %%mm3 \n\t" | |
174 PMAXW(%%mm0, %%mm3) | |
175 "movd %%mm3, %%eax \n\t" | |
176 "movzbl %%al, %%eax \n\t" // last_non_zero_p1 | |
177 : "+a" (last_non_zero_p1) | |
178 : "r" (block+64), "r" (qmat+64), "r" (bias+64), | |
179 "r" (inv_zigzag_direct16+64), "r" (temp_block+64) | |
180 ); | |
181 // note the asm is split cuz gcc doesnt like that many operands ... | |
182 asm volatile( | |
183 "movd %1, %%mm1 \n\t" // max_qcoeff | |
184 SPREADW(%%mm1) | |
185 "psubusw %%mm1, %%mm4 \n\t" | |
186 "packuswb %%mm4, %%mm4 \n\t" | |
187 "movd %%mm4, %0 \n\t" // *overflow | |
188 : "=g" (*overflow) | |
189 : "g" (s->max_qcoeff) | |
344 | 190 ); |
191 } | |
192 | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
193 if(s->mb_intra) block[0]= level; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
194 else block[0]= temp_block[0]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
195 |
1092 | 196 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
|
197 if(last_non_zero_p1 <= 1) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
198 block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
199 block[0x20] = temp_block[0x10]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
200 if(last_non_zero_p1 <= 4) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
201 block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
202 block[0x09] = temp_block[0x03]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
203 if(last_non_zero_p1 <= 7) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
204 block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
205 block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
206 if(last_non_zero_p1 <= 11) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
207 block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
208 block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
209 block[0x0C] = temp_block[0x05]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
210 if(last_non_zero_p1 <= 16) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
211 block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
212 block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
213 block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
214 block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
215 if(last_non_zero_p1 <= 24) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
216 block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
217 block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
218 block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
219 block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
220 if(last_non_zero_p1 <= 32) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
221 block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
222 block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
223 block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
224 block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
225 if(last_non_zero_p1 <= 40) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
226 block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
227 block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
228 block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
229 block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
230 if(last_non_zero_p1 <= 48) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
231 block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
232 block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
233 block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
234 block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
235 if(last_non_zero_p1 <= 56) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
236 block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
237 block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
238 block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
239 block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; |
1092 | 240 }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
|
241 if(last_non_zero_p1 <= 1) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
242 block[0x04] = temp_block[0x01]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
243 block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
244 if(last_non_zero_p1 <= 4) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
245 block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
246 block[0x05] = temp_block[0x03]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
247 if(last_non_zero_p1 <= 7) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
248 block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
249 block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
250 if(last_non_zero_p1 <= 11) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
251 block[0x1C] = temp_block[0x19]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
252 block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
253 block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
254 if(last_non_zero_p1 <= 16) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
255 block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
256 block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
257 block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
258 block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
259 if(last_non_zero_p1 <= 24) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
260 block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
261 block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
262 block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
263 block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
264 if(last_non_zero_p1 <= 32) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
265 block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
266 block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
267 block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
268 block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
269 if(last_non_zero_p1 <= 40) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
270 block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
271 block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
272 block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
273 block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
274 if(last_non_zero_p1 <= 48) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
275 block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
276 block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
277 block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
278 block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
279 if(last_non_zero_p1 <= 56) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
280 block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
281 block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
282 block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
283 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
|
284 }else{ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
285 if(last_non_zero_p1 <= 1) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
286 block[0x01] = temp_block[0x01]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
287 block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
288 if(last_non_zero_p1 <= 4) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
289 block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
290 block[0x03] = temp_block[0x03]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
291 if(last_non_zero_p1 <= 7) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
292 block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
293 block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
294 if(last_non_zero_p1 <= 11) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
295 block[0x19] = temp_block[0x19]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
296 block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
297 block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
298 if(last_non_zero_p1 <= 16) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
299 block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
300 block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
301 block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
302 block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
303 if(last_non_zero_p1 <= 24) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
304 block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
305 block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
306 block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
307 block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
308 if(last_non_zero_p1 <= 32) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
309 block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
310 block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
311 block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
312 block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
313 if(last_non_zero_p1 <= 40) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
314 block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
315 block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
316 block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
317 block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
318 if(last_non_zero_p1 <= 48) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
319 block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
320 block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
321 block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
322 block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
323 if(last_non_zero_p1 <= 56) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
324 block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
325 block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
326 block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
327 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
|
328 } |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
329 end: |
220 | 330 /* |
331 for(i=0; i<last_non_zero_p1; i++) | |
332 { | |
333 int j= zigzag_direct_noperm[i]; | |
334 block[block_permute_op(j)]= temp_block[j]; | |
335 } | |
336 */ | |
344 | 337 |
220 | 338 return last_non_zero_p1 - 1; |
339 } |