annotate i386/mpegvideo_mmx_template.c @ 1248:25fb0364c4bb libavcodec

* sync
author kabi
date Mon, 12 May 2003 17:59:26 +0000
parents f59c3f66363b
children afdd177080c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
1 /*
429
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
2 * MPEG video MMX templates
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
3 *
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
4 * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at>
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
5 *
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
6 * This library is free software; you can redistribute it and/or
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
8 * License as published by the Free Software Foundation; either
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
9 * version 2 of the License, or (at your option) any later version.
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
10 *
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
11 * This library is distributed in the hope that it will be useful,
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
14 * Lesser General Public License for more details.
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
15 *
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
17 * License along with this library; if not, write to the Free Software
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
718a22dc121f license/copyright change
glantau
parents: 350
diff changeset
19 */
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
20 #undef SPREADW
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
21 #undef PMAXW
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
22 #ifdef HAVE_MMX2
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
23 #define SPREADW(a) "pshufw $0, " #a ", " #a " \n\t"
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
24 #define PMAXW(a,b) "pmaxsw " #a ", " #b " \n\t"
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
25
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
26 #else
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
27 #define SPREADW(a) \
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
28 "punpcklwd " #a ", " #a " \n\t"\
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
29 "punpcklwd " #a ", " #a " \n\t"
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
30 #define PMAXW(a,b) \
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
31 "psubusw " #a ", " #b " \n\t"\
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
32 "paddw " #a ", " #b " \n\t"
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
33 #endif
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
34
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
35 static int RENAME(dct_quantize)(MpegEncContext *s,
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
36 DCTELEM *block, int n,
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
37 int qscale, int *overflow)
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
38 {
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
39 int level=0, last_non_zero_p1, q; //=0 is cuz gcc says uninitalized ...
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1013
diff changeset
40 const uint16_t *qmat, *bias;
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1013
diff changeset
41 static __align8 int16_t temp_block[64];
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
42
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
43 //s->fdct (block);
687
9abb13c21fbe fdct_mmx -> ff_fdct_mmx (renamed to avoid namespace conflict with xvid)
arpi_esp
parents: 641
diff changeset
44 ff_fdct_mmx (block); //cant be anything else ...
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
45
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
46 if (s->mb_intra) {
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
47 int dummy;
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
48 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
49 q = s->y_dc_scale;
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
50 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
51 q = s->c_dc_scale;
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
52 /* 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
53 if (!s->h263_aic) {
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
54 #if 1
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
55 asm volatile (
1013
5d4c95f323d0 finetuneing thresholds/factors
michaelni
parents: 706
diff changeset
56 "imul %%ecx \n\t"
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
57 : "=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
58 : "a" ((block[0]>>2) + q), "c" (inverse[q<<1])
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
59 );
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
60 #else
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
61 asm volatile (
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
62 "xorl %%edx, %%edx \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
63 "divw %%cx \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
64 "movzwl %%ax, %%eax \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
65 : "=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
66 : "a" ((block[0]>>2) + q), "c" (q<<1)
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
67 : "%edx"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
68 );
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
69 #endif
350
6ebbecc10063 - Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents: 344
diff changeset
70 } else
6ebbecc10063 - Advanced Intra Coding (AIC) support for H.263+ encoder, just DC by now.
pulento
parents: 344
diff changeset
71 /* 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
72 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
73
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
74 block[0]=0; //avoid fake overflow
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
75 // temp_block[0] = (block[0] + (q >> 1)) / q;
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
76 last_non_zero_p1 = 1;
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
77 bias = s->q_intra_matrix16_bias[qscale];
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
78 qmat = s->q_intra_matrix16[qscale];
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
79 } else {
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
80 last_non_zero_p1 = 0;
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
81 bias = s->q_inter_matrix16_bias[qscale];
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
82 qmat = s->q_inter_matrix16[qscale];
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
83 }
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
84
599
b1a191202f96 mpeg4 mpeg quantizer encoding
michaelni
parents: 429
diff changeset
85 if(s->out_format == FMT_H263 && s->mpeg_quant==0){
1248
kabi
parents: 1092
diff changeset
86 /* PROLOGUE */
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
87 asm volatile(
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
88 "movd %%eax, %%mm3 \n\t" // last_non_zero_p1
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
89 SPREADW(%%mm3)
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
90 "pxor %%mm7, %%mm7 \n\t" // 0
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
91 "pxor %%mm4, %%mm4 \n\t" // 0
1248
kabi
parents: 1092
diff changeset
92 "movq (%1), %%mm5 \n\t" // qmat[0]
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
93 "pxor %%mm6, %%mm6 \n\t"
1248
kabi
parents: 1092
diff changeset
94 "psubw (%2), %%mm6 \n\t" // -bias[0]
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
95 "movl $-128, %%eax \n\t"
1248
kabi
parents: 1092
diff changeset
96 : "+a" (last_non_zero_p1)
kabi
parents: 1092
diff changeset
97 : "r" (qmat), "r" (bias)
kabi
parents: 1092
diff changeset
98 );
kabi
parents: 1092
diff changeset
99 /* CORE */
kabi
parents: 1092
diff changeset
100 asm volatile(
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
101 ".balign 16 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
102 "1: \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
103 "pxor %%mm1, %%mm1 \n\t" // 0
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
104 "movq (%1, %%eax), %%mm0 \n\t" // block[i]
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
105 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
106 "pxor %%mm1, %%mm0 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
107 "psubw %%mm1, %%mm0 \n\t" // ABS(block[i])
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
108 "psubusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0]
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
109 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
110 "por %%mm0, %%mm4 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
111 "pxor %%mm1, %%mm0 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
112 "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
1248
kabi
parents: 1092
diff changeset
113 "movq %%mm0, (%3, %%eax) \n\t"
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
114 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00
1248
kabi
parents: 1092
diff changeset
115 "movq (%2, %%eax), %%mm1 \n\t"
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
116 "movq %%mm7, (%1, %%eax) \n\t" // 0
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
117 "pandn %%mm1, %%mm0 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
118 PMAXW(%%mm0, %%mm3)
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
119 "addl $8, %%eax \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
120 " js 1b \n\t"
1248
kabi
parents: 1092
diff changeset
121 : "+a" (last_non_zero_p1)
kabi
parents: 1092
diff changeset
122 : "r" (block+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
kabi
parents: 1092
diff changeset
123 );
kabi
parents: 1092
diff changeset
124 /* EPILOGUE */
kabi
parents: 1092
diff changeset
125 asm volatile(
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
126 "movq %%mm3, %%mm0 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
127 "psrlq $32, %%mm3 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
128 PMAXW(%%mm0, %%mm3)
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
129 "movq %%mm3, %%mm0 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
130 "psrlq $16, %%mm3 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
131 PMAXW(%%mm0, %%mm3)
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
132 "movd %%mm3, %%eax \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
133 "movzbl %%al, %%eax \n\t" // last_non_zero_p1
1248
kabi
parents: 1092
diff changeset
134 "movd %2, %%mm1 \n\t" // max_qcoeff
kabi
parents: 1092
diff changeset
135 SPREADW(%%mm1)
kabi
parents: 1092
diff changeset
136 "psubusw %%mm1, %%mm4 \n\t"
kabi
parents: 1092
diff changeset
137 "packuswb %%mm4, %%mm4 \n\t"
kabi
parents: 1092
diff changeset
138 "movd %%mm4, %1 \n\t" // *overflow
kabi
parents: 1092
diff changeset
139 : "+a" (last_non_zero_p1), "=r" (*overflow)
kabi
parents: 1092
diff changeset
140 : "r" (s->max_qcoeff)
kabi
parents: 1092
diff changeset
141 );
kabi
parents: 1092
diff changeset
142 }else{ // FMT_H263
kabi
parents: 1092
diff changeset
143 asm volatile(
kabi
parents: 1092
diff changeset
144 "pushl %%ebp \n\t"
kabi
parents: 1092
diff changeset
145 "pushl %%ebx \n\t"
kabi
parents: 1092
diff changeset
146 "movl %0, %%ebp \n\t"
kabi
parents: 1092
diff changeset
147 "movl (%%ebp), %%ebx \n\t"
kabi
parents: 1092
diff changeset
148 "movd %%ebx, %%mm3 \n\t" // last_non_zero_p1
kabi
parents: 1092
diff changeset
149 SPREADW(%%mm3)
kabi
parents: 1092
diff changeset
150 "pxor %%mm7, %%mm7 \n\t" // 0
kabi
parents: 1092
diff changeset
151 "pxor %%mm4, %%mm4 \n\t" // 0
kabi
parents: 1092
diff changeset
152 "movl $-128, %%ebx \n\t"
kabi
parents: 1092
diff changeset
153 ".balign 16 \n\t"
kabi
parents: 1092
diff changeset
154 "1: \n\t"
kabi
parents: 1092
diff changeset
155 "pxor %%mm1, %%mm1 \n\t" // 0
kabi
parents: 1092
diff changeset
156 "movq (%1, %%ebx), %%mm0 \n\t" // block[i]
kabi
parents: 1092
diff changeset
157 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00
kabi
parents: 1092
diff changeset
158 "pxor %%mm1, %%mm0 \n\t"
kabi
parents: 1092
diff changeset
159 "psubw %%mm1, %%mm0 \n\t" // ABS(block[i])
kabi
parents: 1092
diff changeset
160 "movq (%3, %%ebx), %%mm6 \n\t" // bias[0]
kabi
parents: 1092
diff changeset
161 "paddusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0]
kabi
parents: 1092
diff changeset
162 "movq (%2, %%ebx), %%mm5 \n\t" // qmat[i]
kabi
parents: 1092
diff changeset
163 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
kabi
parents: 1092
diff changeset
164 "por %%mm0, %%mm4 \n\t"
kabi
parents: 1092
diff changeset
165 "pxor %%mm1, %%mm0 \n\t"
kabi
parents: 1092
diff changeset
166 "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
kabi
parents: 1092
diff changeset
167 "movq %%mm0, (%5, %%ebx) \n\t"
kabi
parents: 1092
diff changeset
168 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00
kabi
parents: 1092
diff changeset
169 "movq (%4, %%ebx), %%mm1 \n\t"
kabi
parents: 1092
diff changeset
170 "movq %%mm7, (%1, %%ebx) \n\t" // 0
kabi
parents: 1092
diff changeset
171 "pandn %%mm1, %%mm0 \n\t"
kabi
parents: 1092
diff changeset
172 PMAXW(%%mm0, %%mm3)
kabi
parents: 1092
diff changeset
173 "addl $8, %%ebx \n\t"
kabi
parents: 1092
diff changeset
174 " js 1b \n\t"
kabi
parents: 1092
diff changeset
175 "movq %%mm3, %%mm0 \n\t"
kabi
parents: 1092
diff changeset
176 "psrlq $32, %%mm3 \n\t"
kabi
parents: 1092
diff changeset
177 PMAXW(%%mm0, %%mm3)
kabi
parents: 1092
diff changeset
178 "movq %%mm3, %%mm0 \n\t"
kabi
parents: 1092
diff changeset
179 "psrlq $16, %%mm3 \n\t"
kabi
parents: 1092
diff changeset
180 PMAXW(%%mm0, %%mm3)
kabi
parents: 1092
diff changeset
181 "movd %%mm3, %%ebx \n\t"
kabi
parents: 1092
diff changeset
182 "movzbl %%bl, %%ebx \n\t" // last_non_zero_p1
kabi
parents: 1092
diff changeset
183 "movl %%ebx, (%%ebp) \n\t"
kabi
parents: 1092
diff changeset
184 "popl %%ebx \n\t"
kabi
parents: 1092
diff changeset
185 "popl %%ebp \n\t"
kabi
parents: 1092
diff changeset
186 :
kabi
parents: 1092
diff changeset
187 : "m" (last_non_zero_p1),
kabi
parents: 1092
diff changeset
188 "r" (block+64), "r" (qmat+64), "r" (bias+64),
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
189 "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
190 );
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
191 // note the asm is split cuz gcc doesnt like that many operands ...
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
192 asm volatile(
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
193 "movd %1, %%mm1 \n\t" // max_qcoeff
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
194 SPREADW(%%mm1)
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
195 "psubusw %%mm1, %%mm4 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
196 "packuswb %%mm4, %%mm4 \n\t"
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
197 "movd %%mm4, %0 \n\t" // *overflow
1248
kabi
parents: 1092
diff changeset
198 : "=r" (*overflow)
kabi
parents: 1092
diff changeset
199 : "r" (s->max_qcoeff)
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
200 );
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
201 }
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
202
706
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
203 if(s->mb_intra) block[0]= level;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
204 else block[0]= temp_block[0];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
205
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1064
diff changeset
206 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
207 if(last_non_zero_p1 <= 1) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
208 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
209 block[0x20] = temp_block[0x10];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
210 if(last_non_zero_p1 <= 4) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
211 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
212 block[0x09] = temp_block[0x03];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
213 if(last_non_zero_p1 <= 7) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
214 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
215 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
216 if(last_non_zero_p1 <= 11) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
217 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
218 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
219 block[0x0C] = temp_block[0x05];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
220 if(last_non_zero_p1 <= 16) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
221 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
222 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
223 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
224 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
225 if(last_non_zero_p1 <= 24) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
226 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
227 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
228 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
229 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
230 if(last_non_zero_p1 <= 32) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
231 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
232 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
233 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
234 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
235 if(last_non_zero_p1 <= 40) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
236 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
237 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
238 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
239 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
240 if(last_non_zero_p1 <= 48) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
241 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
242 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
243 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
244 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
245 if(last_non_zero_p1 <= 56) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
246 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
247 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
248 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
249 block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1064
diff changeset
250 }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
251 if(last_non_zero_p1 <= 1) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
252 block[0x04] = temp_block[0x01];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
253 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
254 if(last_non_zero_p1 <= 4) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
255 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
256 block[0x05] = temp_block[0x03];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
257 if(last_non_zero_p1 <= 7) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
258 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
259 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
260 if(last_non_zero_p1 <= 11) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
261 block[0x1C] = temp_block[0x19];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
262 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
263 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
264 if(last_non_zero_p1 <= 16) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
265 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
266 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
267 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
268 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
269 if(last_non_zero_p1 <= 24) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
270 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
271 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
272 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
273 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
274 if(last_non_zero_p1 <= 32) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
275 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
276 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
277 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
278 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
279 if(last_non_zero_p1 <= 40) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
280 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
281 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
282 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
283 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
284 if(last_non_zero_p1 <= 48) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
285 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
286 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
287 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
288 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
289 if(last_non_zero_p1 <= 56) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
290 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
291 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
292 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
293 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
294 }else{
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
295 if(last_non_zero_p1 <= 1) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
296 block[0x01] = temp_block[0x01];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
297 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
298 if(last_non_zero_p1 <= 4) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
299 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
300 block[0x03] = temp_block[0x03];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
301 if(last_non_zero_p1 <= 7) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
302 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
303 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
304 if(last_non_zero_p1 <= 11) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
305 block[0x19] = temp_block[0x19];
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
306 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
307 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
308 if(last_non_zero_p1 <= 16) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
309 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
310 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
311 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
312 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
313 if(last_non_zero_p1 <= 24) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
314 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
315 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
316 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
317 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
318 if(last_non_zero_p1 <= 32) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
319 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
320 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
321 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
322 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
323 if(last_non_zero_p1 <= 40) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
324 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
325 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
326 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
327 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
328 if(last_non_zero_p1 <= 48) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
329 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
330 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
331 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
332 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
333 if(last_non_zero_p1 <= 56) goto end;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
334 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
335 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
336 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
337 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
338 }
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 687
diff changeset
339 end:
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
340 /*
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
341 for(i=0; i<last_non_zero_p1; i++)
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
342 {
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
343 int j= zigzag_direct_noperm[i];
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
344 block[block_permute_op(j)]= temp_block[j];
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
345 }
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
346 */
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 230
diff changeset
347
220
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
348 return last_non_zero_p1 - 1;
0b234715e205 (commit by michael)
arpi_esp
parents:
diff changeset
349 }