Mercurial > libavcodec.hg
annotate i386/mpegvideo_mmx_template.c @ 2481:0803adcb3ec3 libavcodec
Add 32bit RGB support
author | rtognimp |
---|---|
date | Mon, 31 Jan 2005 22:34:02 +0000 |
parents | 5e5cf598a48b |
children | 41315d0120b3 |
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 { |
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
|
39 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
|
40 int level=0, q; //=0 is cuz gcc says uninitalized ... |
1064 | 41 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
|
42 __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
|
43 |
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
|
44 assert((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly? |
220 | 45 |
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
|
46 //s->fdct (block); |
1565 | 47 RENAMEl(ff_fdct) (block); //cant be anything else ... |
344 | 48 |
1597 | 49 if(s->dct_error_sum) |
1719 | 50 s->denoise_dct(s, block); |
1597 | 51 |
220 | 52 if (s->mb_intra) { |
53 int dummy; | |
54 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
|
55 q = s->y_dc_scale; |
220 | 56 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
|
57 q = s->c_dc_scale; |
220 | 58 /* 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
|
59 if (!s->h263_aic) { |
220 | 60 #if 1 |
344 | 61 asm volatile ( |
2115 | 62 "mul %%ecx \n\t" |
344 | 63 : "=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
|
64 : "a" ((block[0]>>2) + q), "c" (inverse[q<<1]) |
344 | 65 ); |
220 | 66 #else |
344 | 67 asm volatile ( |
68 "xorl %%edx, %%edx \n\t" | |
69 "divw %%cx \n\t" | |
70 "movzwl %%ax, %%eax \n\t" | |
71 : "=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
|
72 : "a" ((block[0]>>2) + q), "c" (q<<1) |
344 | 73 : "%edx" |
74 ); | |
220 | 75 #endif |
350
6ebbecc10063
- Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents:
344
diff
changeset
|
76 } else |
6ebbecc10063
- Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents:
344
diff
changeset
|
77 /* 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
|
78 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
|
79 |
344 | 80 block[0]=0; //avoid fake overflow |
220 | 81 // temp_block[0] = (block[0] + (q >> 1)) / q; |
82 last_non_zero_p1 = 1; | |
1554
d736e24bf303
move mmx quantizer matrixes out of MpegEncContext (23k -> 7k) (no meassureable slowdown)
michael
parents:
1403
diff
changeset
|
83 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
|
84 qmat = s->q_intra_matrix16[qscale][0]; |
220 | 85 } else { |
86 last_non_zero_p1 = 0; | |
1554
d736e24bf303
move mmx quantizer matrixes out of MpegEncContext (23k -> 7k) (no meassureable slowdown)
michael
parents:
1403
diff
changeset
|
87 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
|
88 qmat = s->q_inter_matrix16[qscale][0]; |
220 | 89 } |
90 | |
2327
5e5cf598a48b
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
2293
diff
changeset
|
91 if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){ |
1251 | 92 |
344 | 93 asm volatile( |
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
|
94 "movd %%"REG_a", %%mm3 \n\t" // last_non_zero_p1 |
344 | 95 SPREADW(%%mm3) |
96 "pxor %%mm7, %%mm7 \n\t" // 0 | |
97 "pxor %%mm4, %%mm4 \n\t" // 0 | |
1251 | 98 "movq (%2), %%mm5 \n\t" // qmat[0] |
344 | 99 "pxor %%mm6, %%mm6 \n\t" |
1251 | 100 "psubw (%3), %%mm6 \n\t" // -bias[0] |
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
|
101 "mov $-128, %%"REG_a" \n\t" |
344 | 102 ".balign 16 \n\t" |
103 "1: \n\t" | |
104 "pxor %%mm1, %%mm1 \n\t" // 0 | |
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
|
105 "movq (%1, %%"REG_a"), %%mm0 \n\t" // block[i] |
344 | 106 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 |
107 "pxor %%mm1, %%mm0 \n\t" | |
108 "psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) | |
109 "psubusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] | |
110 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16 | |
111 "por %%mm0, %%mm4 \n\t" | |
112 "pxor %%mm1, %%mm0 \n\t" | |
113 "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) | |
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
|
114 "movq %%mm0, (%5, %%"REG_a") \n\t" |
344 | 115 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 |
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
|
116 "movq (%4, %%"REG_a"), %%mm1 \n\t" |
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
|
117 "movq %%mm7, (%1, %%"REG_a") \n\t" // 0 |
344 | 118 "pandn %%mm1, %%mm0 \n\t" |
119 PMAXW(%%mm0, %%mm3) | |
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
|
120 "add $8, %%"REG_a" \n\t" |
344 | 121 " js 1b \n\t" |
122 "movq %%mm3, %%mm0 \n\t" | |
123 "psrlq $32, %%mm3 \n\t" | |
124 PMAXW(%%mm0, %%mm3) | |
125 "movq %%mm3, %%mm0 \n\t" | |
126 "psrlq $16, %%mm3 \n\t" | |
127 PMAXW(%%mm0, %%mm3) | |
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
|
128 "movd %%mm3, %%"REG_a" \n\t" |
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
|
129 "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1 |
1251 | 130 : "+a" (last_non_zero_p1) |
131 : "r" (block+64), "r" (qmat), "r" (bias), | |
344 | 132 "r" (inv_zigzag_direct16+64), "r" (temp_block+64) |
133 ); | |
134 // note the asm is split cuz gcc doesnt like that many operands ... | |
135 asm volatile( | |
136 "movd %1, %%mm1 \n\t" // max_qcoeff | |
137 SPREADW(%%mm1) | |
138 "psubusw %%mm1, %%mm4 \n\t" | |
139 "packuswb %%mm4, %%mm4 \n\t" | |
140 "movd %%mm4, %0 \n\t" // *overflow | |
1251 | 141 : "=g" (*overflow) |
142 : "g" (s->max_qcoeff) | |
143 ); | |
144 }else{ // FMT_H263 | |
145 asm volatile( | |
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
|
146 "movd %%"REG_a", %%mm3 \n\t" // last_non_zero_p1 |
1251 | 147 SPREADW(%%mm3) |
148 "pxor %%mm7, %%mm7 \n\t" // 0 | |
149 "pxor %%mm4, %%mm4 \n\t" // 0 | |
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
|
150 "mov $-128, %%"REG_a" \n\t" |
1251 | 151 ".balign 16 \n\t" |
152 "1: \n\t" | |
153 "pxor %%mm1, %%mm1 \n\t" // 0 | |
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
|
154 "movq (%1, %%"REG_a"), %%mm0 \n\t" // block[i] |
1251 | 155 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 |
156 "pxor %%mm1, %%mm0 \n\t" | |
157 "psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) | |
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
|
158 "movq (%3, %%"REG_a"), %%mm6 \n\t" // bias[0] |
1251 | 159 "paddusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] |
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
|
160 "movq (%2, %%"REG_a"), %%mm5 \n\t" // qmat[i] |
1251 | 161 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16 |
162 "por %%mm0, %%mm4 \n\t" | |
163 "pxor %%mm1, %%mm0 \n\t" | |
164 "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) | |
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
|
165 "movq %%mm0, (%5, %%"REG_a") \n\t" |
1251 | 166 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 |
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
|
167 "movq (%4, %%"REG_a"), %%mm1 \n\t" |
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
|
168 "movq %%mm7, (%1, %%"REG_a") \n\t" // 0 |
1251 | 169 "pandn %%mm1, %%mm0 \n\t" |
170 PMAXW(%%mm0, %%mm3) | |
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
|
171 "add $8, %%"REG_a" \n\t" |
1251 | 172 " js 1b \n\t" |
173 "movq %%mm3, %%mm0 \n\t" | |
174 "psrlq $32, %%mm3 \n\t" | |
175 PMAXW(%%mm0, %%mm3) | |
176 "movq %%mm3, %%mm0 \n\t" | |
177 "psrlq $16, %%mm3 \n\t" | |
178 PMAXW(%%mm0, %%mm3) | |
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
|
179 "movd %%mm3, %%"REG_a" \n\t" |
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
|
180 "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1 |
1251 | 181 : "+a" (last_non_zero_p1) |
182 : "r" (block+64), "r" (qmat+64), "r" (bias+64), | |
183 "r" (inv_zigzag_direct16+64), "r" (temp_block+64) | |
184 ); | |
185 // note the asm is split cuz gcc doesnt like that many operands ... | |
186 asm volatile( | |
187 "movd %1, %%mm1 \n\t" // max_qcoeff | |
188 SPREADW(%%mm1) | |
189 "psubusw %%mm1, %%mm4 \n\t" | |
190 "packuswb %%mm4, %%mm4 \n\t" | |
191 "movd %%mm4, %0 \n\t" // *overflow | |
192 : "=g" (*overflow) | |
193 : "g" (s->max_qcoeff) | |
344 | 194 ); |
195 } | |
196 | |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
197 if(s->mb_intra) block[0]= level; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
198 else block[0]= temp_block[0]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
199 |
1092 | 200 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
|
201 if(last_non_zero_p1 <= 1) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
202 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
|
203 block[0x20] = temp_block[0x10]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
204 if(last_non_zero_p1 <= 4) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
205 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
|
206 block[0x09] = temp_block[0x03]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
207 if(last_non_zero_p1 <= 7) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
208 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
|
209 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
|
210 if(last_non_zero_p1 <= 11) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
211 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
|
212 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
|
213 block[0x0C] = temp_block[0x05]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
214 if(last_non_zero_p1 <= 16) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 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
|
219 if(last_non_zero_p1 <= 24) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
220 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
|
221 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
|
222 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
|
223 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
|
224 if(last_non_zero_p1 <= 32) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
225 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
|
226 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
|
227 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
|
228 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
|
229 if(last_non_zero_p1 <= 40) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
230 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
|
231 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
|
232 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
|
233 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
|
234 if(last_non_zero_p1 <= 48) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
235 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
|
236 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
|
237 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
|
238 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
|
239 if(last_non_zero_p1 <= 56) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
240 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
|
241 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
|
242 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
|
243 block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; |
1092 | 244 }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
|
245 if(last_non_zero_p1 <= 1) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
246 block[0x04] = temp_block[0x01]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
247 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
|
248 if(last_non_zero_p1 <= 4) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
249 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
|
250 block[0x05] = temp_block[0x03]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
251 if(last_non_zero_p1 <= 7) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
252 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
|
253 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
|
254 if(last_non_zero_p1 <= 11) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
255 block[0x1C] = temp_block[0x19]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
256 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
|
257 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
|
258 if(last_non_zero_p1 <= 16) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 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
|
263 if(last_non_zero_p1 <= 24) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
264 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
|
265 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
|
266 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
|
267 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
|
268 if(last_non_zero_p1 <= 32) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
269 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
|
270 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
|
271 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
|
272 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
|
273 if(last_non_zero_p1 <= 40) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
274 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
|
275 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
|
276 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
|
277 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
|
278 if(last_non_zero_p1 <= 48) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 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
|
283 if(last_non_zero_p1 <= 56) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
284 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
|
285 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
|
286 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
|
287 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
|
288 }else{ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
289 if(last_non_zero_p1 <= 1) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
290 block[0x01] = temp_block[0x01]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
291 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
|
292 if(last_non_zero_p1 <= 4) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
293 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
|
294 block[0x03] = temp_block[0x03]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
295 if(last_non_zero_p1 <= 7) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
296 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
|
297 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
|
298 if(last_non_zero_p1 <= 11) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
299 block[0x19] = temp_block[0x19]; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
300 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
|
301 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
|
302 if(last_non_zero_p1 <= 16) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 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
|
307 if(last_non_zero_p1 <= 24) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
308 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
|
309 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
|
310 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
|
311 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
|
312 if(last_non_zero_p1 <= 32) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
313 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
|
314 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
|
315 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
|
316 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
|
317 if(last_non_zero_p1 <= 40) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
318 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
|
319 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
|
320 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
|
321 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
|
322 if(last_non_zero_p1 <= 48) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
323 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
|
324 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
|
325 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
|
326 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
|
327 if(last_non_zero_p1 <= 56) goto end; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
328 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
|
329 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
|
330 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
|
331 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
|
332 } |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
687
diff
changeset
|
333 end: |
220 | 334 /* |
335 for(i=0; i<last_non_zero_p1; i++) | |
336 { | |
337 int j= zigzag_direct_noperm[i]; | |
338 block[block_permute_op(j)]= temp_block[j]; | |
339 } | |
340 */ | |
344 | 341 |
220 | 342 return last_non_zero_p1 - 1; |
343 } |