annotate i386/mpegvideo_mmx_template.c @ 4573:58afae0471ae libavcodec

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