annotate i386/mpegvideo_mmx.c @ 153:acbd3bc999b3 libavcodec

Let loops will be aligned
author nickols_k
date Sun, 11 Nov 2001 17:55:54 +0000
parents bd1adece8280
children 6ab301aaa652
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
1 /*
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
2 * The simplest mpeg encoder (well, it was the simplest!)
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
3 * Copyright (c) 2000,2001 Gerard Lantau.
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
4 *
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
8 * (at your option) any later version.
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
9 *
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
13 * GNU General Public License for more details.
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
14 *
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
18 *
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
19 * Optimized for ia32 cpus by Nick Kurshev <nickols_k@mail.ru>
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
20 */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
21
14
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
22 #include "../dsputil.h"
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
23 #include "../mpegvideo.h"
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
24
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
25 #if 0
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
26
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
27 /* XXX: GL: I don't understand why this function needs optimization
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
28 (it is called only once per frame!), so I disabled it */
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
29
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
30 void MPV_frame_start(MpegEncContext *s)
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
31 {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
32 if (s->pict_type == B_TYPE) {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
33 __asm __volatile(
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
34 "movl (%1), %%eax\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
35 "movl 4(%1), %%edx\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
36 "movl 8(%1), %%ecx\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
37 "movl %%eax, (%0)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
38 "movl %%edx, 4(%0)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
39 "movl %%ecx, 8(%0)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
40 :
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
41 :"r"(s->current_picture), "r"(s->aux_picture)
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
42 :"eax","edx","ecx","memory");
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
43 } else {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
44 /* swap next and last */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
45 __asm __volatile(
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
46 "movl (%1), %%eax\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
47 "movl 4(%1), %%edx\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
48 "movl 8(%1), %%ecx\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
49 "xchgl (%0), %%eax\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
50 "xchgl 4(%0), %%edx\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
51 "xchgl 8(%0), %%ecx\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
52 "movl %%eax, (%1)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
53 "movl %%edx, 4(%1)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
54 "movl %%ecx, 8(%1)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
55 "movl %%eax, (%2)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
56 "movl %%edx, 4(%2)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
57 "movl %%ecx, 8(%2)\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
58 :
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
59 :"r"(s->last_picture), "r"(s->next_picture), "r"(s->current_picture)
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
60 :"eax","edx","ecx","memory");
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
61 }
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
62 }
14
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
63 #endif
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
64
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
65 static const unsigned long long int mm_wabs __attribute__ ((aligned(8))) = 0xffffffffffffffffULL;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
66 static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001ULL;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
67
145
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
68
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
69 static void dct_unquantize_h263_mmx(MpegEncContext *s,
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
70 DCTELEM *block, int n, int qscale)
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
71 {
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
72 int i, level, qmul, qadd;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
73
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
74 qmul = s->qscale << 1;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
75 qadd = (s->qscale - 1) | 1;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
76
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
77 if (s->mb_intra) {
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
78 if (n < 4)
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
79 block[0] = block[0] * s->y_dc_scale;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
80 else
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
81 block[0] = block[0] * s->c_dc_scale;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
82
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
83 for(i=1; i<8; i++) {
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
84 level = block[i];
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
85 if (level) {
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
86 if (level < 0) {
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
87 level = level * qmul - qadd;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
88 } else {
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
89 level = level * qmul + qadd;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
90 }
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
91 block[i] = level;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
92 }
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
93 }
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
94 } else {
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
95 i = 0;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
96 }
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
97
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
98 asm volatile(
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
99 "movd %1, %%mm6 \n\t" //qmul
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
100 "packssdw %%mm6, %%mm6 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
101 "packssdw %%mm6, %%mm6 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
102 "movd %2, %%mm5 \n\t" //qadd
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
103 "pxor %%mm7, %%mm7 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
104 "packssdw %%mm5, %%mm5 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
105 "packssdw %%mm5, %%mm5 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
106 "psubw %%mm5, %%mm7 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
107 "pxor %%mm4, %%mm4 \n\t"
153
acbd3bc999b3 Let loops will be aligned
nickols_k
parents: 145
diff changeset
108 ".balign 16\n\t"
145
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
109 "1: \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
110 "movq (%0, %3), %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
111 "movq 8(%0, %3), %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
112
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
113 "pmullw %%mm6, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
114 "pmullw %%mm6, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
115
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
116 "movq (%0, %3), %%mm2 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
117 "movq 8(%0, %3), %%mm3 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
118
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
119 "pcmpgtw %%mm4, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
120 "pcmpgtw %%mm4, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
121
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
122 "pxor %%mm2, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
123 "pxor %%mm3, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
124
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
125 "paddw %%mm7, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
126 "paddw %%mm7, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
127
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
128 "pxor %%mm0, %%mm2 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
129 "pxor %%mm1, %%mm3 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
130
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
131 "pcmpeqw %%mm7, %%mm0 \n\t" // block[i] == 0 ? -1 : 0
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
132 "pcmpeqw %%mm7, %%mm1 \n\t" // block[i] == 0 ? -1 : 0
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
133
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
134 "pandn %%mm2, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
135 "pandn %%mm3, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
136
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
137 "movq %%mm0, (%0, %3) \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
138 "movq %%mm1, 8(%0, %3) \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
139
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
140 "addl $16, %3 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
141 "cmpl $128, %3 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
142 "jb 1b \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
143 ::"r" (block), "g"(qmul), "g" (qadd), "r" (2*i)
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
144 : "memory"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
145 );
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
146 }
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
147
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
148
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
149 /*
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
150 NK:
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
151 Note: looking at PARANOID:
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
152 "enable all paranoid tests for rounding, overflows, etc..."
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
153
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
154 #ifdef PARANOID
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
155 if (level < -2048 || level > 2047)
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
156 fprintf(stderr, "unquant error %d %d\n", i, level);
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
157 #endif
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
158 We can suppose that result of two multiplications can't be greate of 0xFFFF
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
159 i.e. is 16-bit, so we use here only PMULLW instruction and can avoid
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
160 a complex multiplication.
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
161 =====================================================
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
162 Full formula for multiplication of 2 integer numbers
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
163 which are represent as high:low words:
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
164 input: value1 = high1:low1
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
165 value2 = high2:low2
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
166 output: value3 = value1*value2
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
167 value3=high3:low3 (on overflow: modulus 2^32 wrap-around)
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
168 this mean that for 0x123456 * 0x123456 correct result is 0x766cb0ce4
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
169 but this algorithm will compute only 0x66cb0ce4
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
170 this limited by 16-bit size of operands
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
171 ---------------------------------
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
172 tlow1 = high1*low2
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
173 tlow2 = high2*low1
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
174 tlow1 = tlow1 + tlow2
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
175 high3:low3 = low1*low2
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
176 high3 += tlow1
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
177 */
14
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
178 static void dct_unquantize_mpeg1_mmx(MpegEncContext *s,
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
179 DCTELEM *block, int n, int qscale)
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
180 {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
181 int i, level;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
182 const UINT16 *quant_matrix;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
183 if (s->mb_intra) {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
184 if (n < 4)
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
185 block[0] = block[0] * s->y_dc_scale;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
186 else
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
187 block[0] = block[0] * s->c_dc_scale;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
188 if (s->out_format == FMT_H263) {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
189 i = 1;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
190 goto unquant_even;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
191 }
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
192 /* XXX: only mpeg1 */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
193 quant_matrix = s->intra_matrix;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
194 i=1;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
195 /* Align on 4 elements boundary */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
196 while(i&3)
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
197 {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
198 level = block[i];
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
199 if (level) {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
200 if (level < 0) level = -level;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
201 level = (int)(level * qscale * quant_matrix[i]) >> 3;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
202 level = (level - 1) | 1;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
203 if (block[i] < 0) level = -level;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
204 block[i] = level;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
205 }
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
206 i++;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
207 }
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
208 __asm __volatile(
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
209 "movd %0, %%mm6\n\t" /* mm6 = qscale | 0 */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
210 "punpckldq %%mm6, %%mm6\n\t" /* mm6 = qscale | qscale */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
211 "movq %2, %%mm4\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
212 "movq %%mm6, %%mm7\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
213 "movq %1, %%mm5\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
214 "packssdw %%mm6, %%mm7\n\t" /* mm7 = qscale | qscale | qscale | qscale */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
215 "pxor %%mm6, %%mm6\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
216 ::"g"(qscale),"m"(mm_wone),"m"(mm_wabs):"memory");
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
217 for(;i<64;i+=4) {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
218 __asm __volatile(
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
219 "movq %1, %%mm0\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
220 "movq %%mm7, %%mm1\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
221 "movq %%mm0, %%mm2\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
222 "movq %%mm0, %%mm3\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
223 "pcmpgtw %%mm6, %%mm2\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
224 "pmullw %2, %%mm1\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
225 "pandn %%mm4, %%mm2\n\t"
145
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
226 "por %%mm5, %%mm2\n\t"
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
227 "pmullw %%mm2, %%mm0\n\t" /* mm0 = abs(block[i]). */
145
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
228
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
229 "pcmpeqw %%mm6, %%mm3\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
230 "pmullw %%mm0, %%mm1\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
231 "psraw $3, %%mm1\n\t"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
232 "psubw %%mm5, %%mm1\n\t" /* block[i] --; */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
233 "pandn %%mm4, %%mm3\n\t" /* fake of pcmpneqw : mm0 != 0 then mm1 = -1 */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
234 "por %%mm5, %%mm1\n\t" /* block[i] |= 1 */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
235 "pmullw %%mm2, %%mm1\n\t" /* change signs again */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
236
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
237 "pand %%mm3, %%mm1\n\t" /* nullify if was zero */
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
238 "movq %%mm1, %0"
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
239 :"=m"(block[i])
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
240 :"m"(block[i]), "m"(quant_matrix[i])
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
241 :"memory");
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
242 }
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
243 } else {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
244 i = 0;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
245 unquant_even:
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
246 quant_matrix = s->non_intra_matrix;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
247 /* Align on 4 elements boundary */
145
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
248 while(i&7)
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
249 {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
250 level = block[i];
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
251 if (level) {
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
252 if (level < 0) level = -level;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
253 level = (((level << 1) + 1) * qscale *
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
254 ((int) quant_matrix[i])) >> 4;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
255 level = (level - 1) | 1;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
256 if(block[i] < 0) level = -level;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
257 block[i] = level;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
258 }
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
259 i++;
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
260 }
145
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
261
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
262 asm volatile(
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
263 "pcmpeqw %%mm7, %%mm7 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
264 "psrlw $15, %%mm7 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
265 "movd %2, %%mm6 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
266 "packssdw %%mm6, %%mm6 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
267 "packssdw %%mm6, %%mm6 \n\t"
153
acbd3bc999b3 Let loops will be aligned
nickols_k
parents: 145
diff changeset
268 ".balign 16\n\t"
145
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
269 "1: \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
270 "movq (%0, %3), %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
271 "movq 8(%0, %3), %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
272 "movq (%1, %3), %%mm4 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
273 "movq 8(%1, %3), %%mm5 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
274 "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
275 "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
276 "pxor %%mm2, %%mm2 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
277 "pxor %%mm3, %%mm3 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
278 "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
279 "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
280 "pxor %%mm2, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
281 "pxor %%mm3, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
282 "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
283 "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
284 "paddw %%mm0, %%mm0 \n\t" // abs(block[i])*2
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
285 "paddw %%mm1, %%mm1 \n\t" // abs(block[i])*2
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
286 "paddw %%mm7, %%mm0 \n\t" // abs(block[i])*2 + 1
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
287 "paddw %%mm7, %%mm1 \n\t" // abs(block[i])*2 + 1
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
288 "pmullw %%mm4, %%mm0 \n\t" // (abs(block[i])*2 + 1)*q
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
289 "pmullw %%mm5, %%mm1 \n\t" // (abs(block[i])*2 + 1)*q
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
290 "pxor %%mm4, %%mm4 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
291 "pxor %%mm5, %%mm5 \n\t" // FIXME slow
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
292 "pcmpeqw (%0, %3), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
293 "pcmpeqw 8(%0, %3), %%mm5 \n\t" // block[i] == 0 ? -1 : 0
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
294 "psraw $4, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
295 "psraw $4, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
296 "psubw %%mm7, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
297 "psubw %%mm7, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
298 "por %%mm7, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
299 "por %%mm7, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
300 "pxor %%mm2, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
301 "pxor %%mm3, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
302 "psubw %%mm2, %%mm0 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
303 "psubw %%mm3, %%mm1 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
304 "pandn %%mm0, %%mm4 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
305 "pandn %%mm1, %%mm5 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
306 "movq %%mm4, (%0, %3) \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
307 "movq %%mm5, 8(%0, %3) \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
308
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
309 "addl $16, %3 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
310 "cmpl $128, %3 \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
311 "jb 1b \n\t"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
312 ::"r" (block), "r"(quant_matrix), "g" (qscale), "r" (2*i)
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
313 : "memory"
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
314 );
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
315 }
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
316 }
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
317
14
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
318 void MPV_common_init_mmx(MpegEncContext *s)
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
319 {
14
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
320 if (mm_flags & MM_MMX) {
145
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
321 if (s->out_format == FMT_H263)
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
322 s->dct_unquantize = dct_unquantize_h263_mmx;
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
323 else
bd1adece8280 dct_unquantize_h263_mmx() by Michael Niedermayer <michaelni@gmx.at>
arpi_esp
parents: 14
diff changeset
324 s->dct_unquantize = dct_unquantize_mpeg1_mmx;
14
8ceb13af9cb6 renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff
glantau
parents: 8
diff changeset
325 }
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents:
diff changeset
326 }