annotate i386/dsputil_h264_template_mmx.c @ 6459:588d15844c80 libavcodec

move ff_mpeg1_dc_scale_table to mpegvideo.c
author aurel
date Wed, 05 Mar 2008 21:29:15 +0000
parents 5969caa9190d
children e1208c4f8898
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
1 /*
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
2 * Copyright (c) 2005 Zoltan Hidvegi <hzoli -a- hzoli -d- com>,
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
3 * Loren Merritt
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3218
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3218
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3218
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
9 * 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: 3218
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3218
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
15 * Lesser General Public License for more details.
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
16 *
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
17 * 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: 3218
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2922
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
20 */
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
21
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
22 /**
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
23 * MMX optimized version of (put|avg)_h264_chroma_mc8.
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
24 * H264_CHROMA_MC8_TMPL must be defined to the desired function name
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
25 * H264_CHROMA_OP must be defined to empty for put and pavgb/pavgusb for avg
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
26 * H264_CHROMA_MC8_MV0 must be defined to a (put|avg)_pixels8 function
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
27 */
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5152
diff changeset
28 static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, int rnd)
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
29 {
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5152
diff changeset
30 DECLARE_ALIGNED_8(static const uint64_t, ff_pw_28) = 0x001C001C001C001CULL;
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5152
diff changeset
31 const uint64_t *rnd_reg;
3089
072dbc669253 MSVC-compatible __align8/__align16 declaration
diego
parents: 3036
diff changeset
32 DECLARE_ALIGNED_8(uint64_t, AA);
072dbc669253 MSVC-compatible __align8/__align16 declaration
diego
parents: 3036
diff changeset
33 DECLARE_ALIGNED_8(uint64_t, DD);
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
34 int i;
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
35
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
36 if(y==0 && x==0) {
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
37 /* no filter needed */
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
38 H264_CHROMA_MC8_MV0(dst, src, stride, h);
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
39 return;
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
40 }
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
41
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
42 assert(x<8 && y<8 && x>=0 && y>=0);
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
43
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
44 if(y==0 || x==0)
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
45 {
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
46 /* 1 dimensional filter only */
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
47 const int dxy = x ? 1 : stride;
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
48
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5152
diff changeset
49 rnd_reg = rnd ? &ff_pw_4 : &ff_pw_3;
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5152
diff changeset
50
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
51 asm volatile(
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
52 "movd %0, %%mm5\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
53 "movq %1, %%mm4\n\t"
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5152
diff changeset
54 "movq %2, %%mm6\n\t" /* mm6 = rnd */
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
55 "punpcklwd %%mm5, %%mm5\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
56 "punpckldq %%mm5, %%mm5\n\t" /* mm5 = B = x */
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
57 "pxor %%mm7, %%mm7\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
58 "psubw %%mm5, %%mm4\n\t" /* mm4 = A = 8-x */
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5152
diff changeset
59 :: "rm"(x+y), "m"(ff_pw_8), "m"(*rnd_reg));
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
60
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
61 for(i=0; i<h; i++) {
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
62 asm volatile(
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
63 /* mm0 = src[0..7], mm1 = src[1..8] */
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
64 "movq %0, %%mm0\n\t"
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
65 "movq %1, %%mm2\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
66 :: "m"(src[0]), "m"(src[dxy]));
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
67
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
68 asm volatile(
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
69 /* [mm0,mm1] = A * src[0..7] */
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
70 /* [mm2,mm3] = B * src[1..8] */
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
71 "movq %%mm0, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
72 "movq %%mm2, %%mm3\n\t"
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
73 "punpcklbw %%mm7, %%mm0\n\t"
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
74 "punpckhbw %%mm7, %%mm1\n\t"
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
75 "punpcklbw %%mm7, %%mm2\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
76 "punpckhbw %%mm7, %%mm3\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
77 "pmullw %%mm4, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
78 "pmullw %%mm4, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
79 "pmullw %%mm5, %%mm2\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
80 "pmullw %%mm5, %%mm3\n\t"
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
81
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
82 /* dst[0..7] = (A * src[0..7] + B * src[1..8] + 4) >> 3 */
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
83 "paddw %%mm6, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
84 "paddw %%mm6, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
85 "paddw %%mm2, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
86 "paddw %%mm3, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
87 "psrlw $3, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
88 "psrlw $3, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
89 "packuswb %%mm1, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
90 H264_CHROMA_OP(%0, %%mm0)
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
91 "movq %%mm0, %0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
92 : "=m" (dst[0]));
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
93
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
94 src += stride;
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
95 dst += stride;
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
96 }
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
97 return;
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
98 }
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
99
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
100 /* general case, bilinear */
6329
5969caa9190d clean up an ugliness introduced in r11826. this syntax will require fewer changes when adding future sse2 code.
lorenm
parents: 6320
diff changeset
101 rnd_reg = rnd ? &ff_pw_32.a : &ff_pw_28;
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
102 asm volatile("movd %2, %%mm4\n\t"
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
103 "movd %3, %%mm6\n\t"
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
104 "punpcklwd %%mm4, %%mm4\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
105 "punpcklwd %%mm6, %%mm6\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
106 "punpckldq %%mm4, %%mm4\n\t" /* mm4 = x words */
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
107 "punpckldq %%mm6, %%mm6\n\t" /* mm6 = y words */
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
108 "movq %%mm4, %%mm5\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
109 "pmullw %%mm6, %%mm4\n\t" /* mm4 = x * y */
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
110 "psllw $3, %%mm5\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
111 "psllw $3, %%mm6\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
112 "movq %%mm5, %%mm7\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
113 "paddw %%mm6, %%mm7\n\t"
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
114 "movq %%mm4, %1\n\t" /* DD = x * y */
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
115 "psubw %%mm4, %%mm5\n\t" /* mm5 = B = 8x - xy */
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
116 "psubw %%mm4, %%mm6\n\t" /* mm6 = C = 8y - xy */
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
117 "paddw %4, %%mm4\n\t"
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
118 "psubw %%mm7, %%mm4\n\t" /* mm4 = A = xy - (8x+8y) + 64 */
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
119 "pxor %%mm7, %%mm7\n\t"
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
120 "movq %%mm4, %0\n\t"
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
121 : "=m" (AA), "=m" (DD) : "rm" (x), "rm" (y), "m" (ff_pw_64));
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
122
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
123 asm volatile(
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
124 /* mm0 = src[0..7], mm1 = src[1..8] */
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
125 "movq %0, %%mm0\n\t"
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
126 "movq %1, %%mm1\n\t"
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
127 : : "m" (src[0]), "m" (src[1]));
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
128
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
129 for(i=0; i<h; i++) {
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
130 src += stride;
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
131
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
132 asm volatile(
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
133 /* mm2 = A * src[0..3] + B * src[1..4] */
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
134 /* mm3 = A * src[4..7] + B * src[5..8] */
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
135 "movq %%mm0, %%mm2\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
136 "movq %%mm1, %%mm3\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
137 "punpckhbw %%mm7, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
138 "punpcklbw %%mm7, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
139 "punpcklbw %%mm7, %%mm2\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
140 "punpckhbw %%mm7, %%mm3\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
141 "pmullw %0, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
142 "pmullw %0, %%mm2\n\t"
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
143 "pmullw %%mm5, %%mm1\n\t"
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
144 "pmullw %%mm5, %%mm3\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
145 "paddw %%mm1, %%mm2\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
146 "paddw %%mm0, %%mm3\n\t"
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
147 : : "m" (AA));
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
148
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
149 asm volatile(
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
150 /* [mm2,mm3] += C * src[0..7] */
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
151 "movq %0, %%mm0\n\t"
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
152 "movq %%mm0, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
153 "punpcklbw %%mm7, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
154 "punpckhbw %%mm7, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
155 "pmullw %%mm6, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
156 "pmullw %%mm6, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
157 "paddw %%mm0, %%mm2\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
158 "paddw %%mm1, %%mm3\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
159 : : "m" (src[0]));
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
160
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
161 asm volatile(
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
162 /* [mm2,mm3] += D * src[1..8] */
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
163 "movq %1, %%mm1\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
164 "movq %%mm1, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
165 "movq %%mm1, %%mm4\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
166 "punpcklbw %%mm7, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
167 "punpckhbw %%mm7, %%mm4\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
168 "pmullw %2, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
169 "pmullw %2, %%mm4\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
170 "paddw %%mm0, %%mm2\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
171 "paddw %%mm4, %%mm3\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
172 "movq %0, %%mm0\n\t"
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
173 : : "m" (src[0]), "m" (src[1]), "m" (DD));
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
174
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
175 asm volatile(
3218
b2ffd9fb4153 simplified and slightly faster h264_chroma_mc8_mmx
lorenm
parents: 3214
diff changeset
176 /* dst[0..7] = ([mm2,mm3] + 32) >> 6 */
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
177 "paddw %1, %%mm2\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
178 "paddw %1, %%mm3\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
179 "psrlw $6, %%mm2\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
180 "psrlw $6, %%mm3\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
181 "packuswb %%mm3, %%mm2\n\t"
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
182 H264_CHROMA_OP(%0, %%mm2)
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
183 "movq %%mm2, %0\n\t"
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5152
diff changeset
184 : "=m" (dst[0]) : "m" (*rnd_reg));
2732
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
185 dst+= stride;
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
186 }
473ee06ec3a1 MMX code for (put|avg)_h264_chroma_mc8
hzoli
parents:
diff changeset
187 }
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
188
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
189 static void H264_CHROMA_MC4_TMPL(uint8_t *dst/*align 4*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
190 {
4538
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
191 asm volatile(
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
192 "pxor %%mm7, %%mm7 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
193 "movd %5, %%mm2 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
194 "movd %6, %%mm3 \n\t"
4560
a798e8cc5e67 gcc 2.95 fix
michael
parents: 4543
diff changeset
195 "movq "MANGLE(ff_pw_8)", %%mm4\n\t"
a798e8cc5e67 gcc 2.95 fix
michael
parents: 4543
diff changeset
196 "movq "MANGLE(ff_pw_8)", %%mm5\n\t"
4538
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
197 "punpcklwd %%mm2, %%mm2 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
198 "punpcklwd %%mm3, %%mm3 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
199 "punpcklwd %%mm2, %%mm2 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
200 "punpcklwd %%mm3, %%mm3 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
201 "psubw %%mm2, %%mm4 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
202 "psubw %%mm3, %%mm5 \n\t"
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
203
4538
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
204 "movd (%1), %%mm0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
205 "movd 1(%1), %%mm6 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
206 "add %3, %1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
207 "punpcklbw %%mm7, %%mm0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
208 "punpcklbw %%mm7, %%mm6 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
209 "pmullw %%mm4, %%mm0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
210 "pmullw %%mm2, %%mm6 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
211 "paddw %%mm0, %%mm6 \n\t"
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
212
4538
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
213 "1: \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
214 "movd (%1), %%mm0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
215 "movd 1(%1), %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
216 "add %3, %1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
217 "punpcklbw %%mm7, %%mm0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
218 "punpcklbw %%mm7, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
219 "pmullw %%mm4, %%mm0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
220 "pmullw %%mm2, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
221 "paddw %%mm0, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
222 "movq %%mm1, %%mm0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
223 "pmullw %%mm5, %%mm6 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
224 "pmullw %%mm3, %%mm1 \n\t"
4585
869c9a1a5006 reorder a few more paddws to reduce dependancy chains
michael
parents: 4584
diff changeset
225 "paddw %4, %%mm6 \n\t"
4538
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
226 "paddw %%mm6, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
227 "psrlw $6, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
228 "packuswb %%mm1, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
229 H264_CHROMA_OP4((%0), %%mm1, %%mm6)
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
230 "movd %%mm1, (%0) \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
231 "add %3, %0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
232 "movd (%1), %%mm6 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
233 "movd 1(%1), %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
234 "add %3, %1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
235 "punpcklbw %%mm7, %%mm6 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
236 "punpcklbw %%mm7, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
237 "pmullw %%mm4, %%mm6 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
238 "pmullw %%mm2, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
239 "paddw %%mm6, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
240 "movq %%mm1, %%mm6 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
241 "pmullw %%mm5, %%mm0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
242 "pmullw %%mm3, %%mm1 \n\t"
4585
869c9a1a5006 reorder a few more paddws to reduce dependancy chains
michael
parents: 4584
diff changeset
243 "paddw %4, %%mm0 \n\t"
4538
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
244 "paddw %%mm0, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
245 "psrlw $6, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
246 "packuswb %%mm1, %%mm1 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
247 H264_CHROMA_OP4((%0), %%mm1, %%mm0)
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
248 "movd %%mm1, (%0) \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
249 "add %3, %0 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
250 "sub $2, %2 \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
251 "jnz 1b \n\t"
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
252 : "+r"(dst), "+r"(src), "+r"(h)
6329
5969caa9190d clean up an ugliness introduced in r11826. this syntax will require fewer changes when adding future sse2 code.
lorenm
parents: 6320
diff changeset
253 : "r"((long)stride), "m"(ff_pw_32), "m"(x), "m"(y)
4538
e64290e64366 rewrite H264_CHROMA_MC4_TMPL (20% faster)
michael
parents: 4509
diff changeset
254 );
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2754
diff changeset
255 }
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
256
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
257 #ifdef H264_CHROMA_MC2_TMPL
5152
4507b67e71cd correct type for {put,avg}_h264_chroma_mc2_mmx2
mru
parents: 4585
diff changeset
258 static void H264_CHROMA_MC2_TMPL(uint8_t *dst/*align 2*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
259 {
4505
cb5628800a62 factor out common subexprssion (gcc of course is too stupid to do this ...)
michael
parents: 4504
diff changeset
260 int tmp = ((1<<16)-1)*x + 8;
cb5628800a62 factor out common subexprssion (gcc of course is too stupid to do this ...)
michael
parents: 4504
diff changeset
261 int CD= tmp*y;
cb5628800a62 factor out common subexprssion (gcc of course is too stupid to do this ...)
michael
parents: 4504
diff changeset
262 int AB= (tmp<<3) - CD;
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
263 asm volatile(
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
264 /* mm5 = {A,B,A,B} */
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
265 /* mm6 = {C,D,C,D} */
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
266 "movd %0, %%mm5\n\t"
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
267 "movd %1, %%mm6\n\t"
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
268 "punpckldq %%mm5, %%mm5\n\t"
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
269 "punpckldq %%mm6, %%mm6\n\t"
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
270 "pxor %%mm7, %%mm7\n\t"
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
271 /* mm0 = src[0,1,1,2] */
4582
384d4c67baaf shortening dependancy chain in chroma mc2
michael
parents: 4581
diff changeset
272 "movd %2, %%mm2\n\t"
384d4c67baaf shortening dependancy chain in chroma mc2
michael
parents: 4581
diff changeset
273 "punpcklbw %%mm7, %%mm2\n\t"
384d4c67baaf shortening dependancy chain in chroma mc2
michael
parents: 4581
diff changeset
274 "pshufw $0x94, %%mm2, %%mm2\n\t"
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
275 :: "r"(AB), "r"(CD), "m"(src[0]));
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
276
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
277
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
278 asm volatile(
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
279 "1:\n\t"
4509
91ccf7e94441 Minor AMD64 compilation fix
reimar
parents: 4508
diff changeset
280 "add %4, %1\n\t"
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
281 /* mm1 = A * src[0,1] + B * src[1,2] */
4582
384d4c67baaf shortening dependancy chain in chroma mc2
michael
parents: 4581
diff changeset
282 "movq %%mm2, %%mm1\n\t"
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
283 "pmaddwd %%mm5, %%mm1\n\t"
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
284 /* mm0 = src[0,1,1,2] */
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
285 "movd (%1), %%mm0\n\t"
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
286 "punpcklbw %%mm7, %%mm0\n\t"
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
287 "pshufw $0x94, %%mm0, %%mm0\n\t"
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
288 /* mm1 += C * src[0,1] + D * src[1,2] */
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
289 "movq %%mm0, %%mm2\n\t"
4582
384d4c67baaf shortening dependancy chain in chroma mc2
michael
parents: 4581
diff changeset
290 "pmaddwd %%mm6, %%mm0\n\t"
4584
3e155276af4a reorder paddws to reduce dependancy chain
michael
parents: 4582
diff changeset
291 "paddw %3, %%mm1\n\t"
4582
384d4c67baaf shortening dependancy chain in chroma mc2
michael
parents: 4581
diff changeset
292 "paddw %%mm0, %%mm1\n\t"
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
293 /* dst[0,1] = pack((mm1 + 32) >> 6) */
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
294 "psrlw $6, %%mm1\n\t"
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
295 "packssdw %%mm7, %%mm1\n\t"
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
296 "packuswb %%mm7, %%mm1\n\t"
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
297 H264_CHROMA_OP4((%0), %%mm1, %%mm3)
4580
55d7ebd2d699 fix chroma mc2 bug, this is based on a patch by (Oleg Metelitsa oleg hitron co kr)
michael
parents: 4560
diff changeset
298 "movd %%mm1, %%esi\n\t"
55d7ebd2d699 fix chroma mc2 bug, this is based on a patch by (Oleg Metelitsa oleg hitron co kr)
michael
parents: 4560
diff changeset
299 "movw %%si, (%0)\n\t"
4508
240aed40371b maybe fix x86_64 (untested)
michael
parents: 4505
diff changeset
300 "add %4, %0\n\t"
240aed40371b maybe fix x86_64 (untested)
michael
parents: 4505
diff changeset
301 "sub $1, %2\n\t"
4504
6287a2ff4d08 merge asm fragments in H264_CHROMA_MC2_TMPL()
michael
parents: 3947
diff changeset
302 "jnz 1b\n\t"
4580
55d7ebd2d699 fix chroma mc2 bug, this is based on a patch by (Oleg Metelitsa oleg hitron co kr)
michael
parents: 4560
diff changeset
303 : "+r" (dst), "+r"(src), "+r"(h)
6329
5969caa9190d clean up an ugliness introduced in r11826. this syntax will require fewer changes when adding future sse2 code.
lorenm
parents: 6320
diff changeset
304 : "m" (ff_pw_32), "r"((long)stride)
4580
55d7ebd2d699 fix chroma mc2 bug, this is based on a patch by (Oleg Metelitsa oleg hitron co kr)
michael
parents: 4560
diff changeset
305 : "%esi");
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
306
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
307 }
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
308 #endif
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3089
diff changeset
309