annotate i386/vc1dsp_mmx.c @ 5945:3413fce9e26a libavcodec

10l: init_get_bits want size in bits, not bytes
author aurel
date Tue, 27 Nov 2007 22:00:45 +0000
parents 7bc05f20e435
children 55251379b5b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5933
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
1 /*
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
2 * VC-1 and WMV3 - DSP functions MMX-optimized
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
3 * Copyright (c) 2007 Christophe GISQUET <christophe.gisquet@free.fr>
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
4 *
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
5 * Permission is hereby granted, free of charge, to any person
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
6 * obtaining a copy of this software and associated documentation
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
7 * files (the "Software"), to deal in the Software without
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
8 * restriction, including without limitation the rights to use,
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
9 * copy, modify, merge, publish, distribute, sublicense, and/or sell
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
10 * copies of the Software, and to permit persons to whom the
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
11 * Software is furnished to do so, subject to the following
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
12 * conditions:
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
13 *
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
14 * The above copyright notice and this permission notice shall be
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
15 * included in all copies or substantial portions of the Software.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
16 *
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
24 * OTHER DEALINGS IN THE SOFTWARE.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
25 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
26
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
27 #include "dsputil.h"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
28 #include "x86_cpu.h"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
29
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
30 /** Add rounder from mm7 to mm3 and pack result at destination */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
31 #define NORMALIZE_MMX(SHIFT) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
32 "paddw %%mm7, %%mm3 \n\t" /* +bias-r */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
33 "paddw %%mm7, %%mm4 \n\t" /* +bias-r */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
34 "psraw "SHIFT", %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
35 "psraw "SHIFT", %%mm4 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
36
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
37 #define TRANSFER_DO_PACK \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
38 "packuswb %%mm4, %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
39 "movq %%mm3, (%2) \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
40
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
41 #define TRANSFER_DONT_PACK \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
42 "movq %%mm3, 0(%2) \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
43 "movq %%mm4, 8(%2) \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
44
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
45 /** @see MSPEL_FILTER13_CORE for use as UNPACK macro */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
46 #define DO_UNPACK(reg) "punpcklbw %%mm0, " reg "\n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
47 #define DONT_UNPACK(reg)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
48
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
49 /** Compute the rounder 32-r or 8-r and unpacks it to mm7 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
50 #define LOAD_ROUNDER_MMX(ROUND) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
51 "movd "ROUND", %%mm7 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
52 "punpcklwd %%mm7, %%mm7 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
53 "punpckldq %%mm7, %%mm7 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
54
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
55 #define SHIFT2_LINE(OFF, R0,R1,R2,R3) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
56 "paddw %%mm"#R2", %%mm"#R1" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
57 "movd (%1,%4), %%mm"#R0" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
58 "pmullw %%mm6, %%mm"#R1" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
59 "punpcklbw %%mm0, %%mm"#R0" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
60 "movd (%1,%3), %%mm"#R3" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
61 "psubw %%mm"#R0", %%mm"#R1" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
62 "punpcklbw %%mm0, %%mm"#R3" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
63 "paddw %%mm7, %%mm"#R1" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
64 "psubw %%mm"#R3", %%mm"#R1" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
65 "psraw %5, %%mm"#R1" \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
66 "movq %%mm"#R1", "#OFF"(%2) \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
67 "add %3, %1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
68
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
69 DECLARE_ALIGNED_16(static const uint64_t, fact_9) = 0x0009000900090009ULL;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
70
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
71 /** Sacrifying mm6 allows to pipeline loads from src */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
72 static void vc1_put_ver_16b_shift2_mmx(int16_t *dst,
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
73 const uint8_t *src, long int stride,
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
74 int rnd, int64_t shift)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
75 {
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
76 int w = 3;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
77
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
78 asm volatile(
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
79 LOAD_ROUNDER_MMX("%6")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
80 "movq %7, %%mm6 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
81 "1: \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
82 "movd (%1), %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
83 "add %3, %1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
84 "movd (%1), %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
85 "punpcklbw %%mm0, %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
86 "punpcklbw %%mm0, %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
87 SHIFT2_LINE( 0, 1, 2, 3, 4)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
88 SHIFT2_LINE( 24, 2, 3, 4, 1)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
89 SHIFT2_LINE( 48, 3, 4, 1, 2)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
90 SHIFT2_LINE( 72, 4, 1, 2, 3)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
91 SHIFT2_LINE( 96, 1, 2, 3, 4)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
92 SHIFT2_LINE(120, 2, 3, 4, 1)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
93 SHIFT2_LINE(144, 3, 4, 1, 2)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
94 SHIFT2_LINE(168, 4, 1, 2, 3)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
95 "sub %8, %1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
96 "add $8, %2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
97 "dec %0 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
98 "jnz 1b \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
99 : "+g"(w), "+r"(src), "+r"(dst)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
100 : "r"(stride), "r"(-2*stride), "m"(shift),
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
101 "m"(rnd), "m"(fact_9), "g"(9*stride-4)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
102 : "memory"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
103 );
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
104 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
105
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
106 /** To remove bias allowing use of MMX 16bits arithmetic */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
107 DECLARE_ALIGNED_16(static const uint64_t, ff_pw_128) = 0x0080008000800080ULL;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
108
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
109 /**
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
110 * Data is already unpacked, so some operations can directly be made from
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
111 * memory.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
112 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
113 static void vc1_put_hor_16b_shift2_mmx(uint8_t *dst, long int stride,
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
114 const int16_t *src, int rnd)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
115 {
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
116 int h = 8;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
117
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
118 src -= 1;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
119 rnd -= (-1+9+9-1)*1024; /* Add -1024 bias */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
120 asm volatile(
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
121 LOAD_ROUNDER_MMX("%4")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
122 "movq %6, %%mm6 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
123 "movq %5, %%mm5 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
124 "1: \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
125 "movq 2*0+0(%1), %%mm1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
126 "movq 2*0+8(%1), %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
127 "movq 2*1+0(%1), %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
128 "movq 2*1+8(%1), %%mm4 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
129 "paddw 2*3+0(%1), %%mm1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
130 "paddw 2*3+8(%1), %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
131 "paddw 2*2+0(%1), %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
132 "paddw 2*2+8(%1), %%mm4 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
133 "pmullw %%mm5, %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
134 "pmullw %%mm5, %%mm4 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
135 "psubw %%mm1, %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
136 "psubw %%mm2, %%mm4 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
137 NORMALIZE_MMX("$7")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
138 /* Remove bias */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
139 "paddw %%mm6, %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
140 "paddw %%mm6, %%mm4 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
141 TRANSFER_DO_PACK
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
142 "add $24, %1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
143 "add %3, %2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
144 "dec %0 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
145 "jnz 1b \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
146 : "+g"(h), "+r" (src), "+r" (dst)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
147 : "g"(stride), "m"(rnd), "m"(fact_9), "m"(ff_pw_128)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
148 : "memory"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
149 );
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
150 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
151
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
152
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
153 /**
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
154 * Purely vertical or horizontal 1/2 shift interpolation.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
155 * Sacrify mm6 for *9 factor.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
156 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
157 static void vc1_put_shift2_mmx(uint8_t *dst, const uint8_t *src,
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
158 long int stride, int rnd, long int offset)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
159 {
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
160 int h = 8;
5936
1f3008bae163 Strip debug stuff from vc1dsp_mmx.c, patch by Christophe GISQUET %hristophe P gisquet A free P fr%
gpoirier
parents: 5933
diff changeset
161
5933
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
162 rnd = 8-rnd;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
163 asm volatile(
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
164 LOAD_ROUNDER_MMX("%6")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
165 "movq %8, %%mm6 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
166 "1: \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
167 "movd 0(%1 ), %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
168 "movd 4(%1 ), %%mm4 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
169 "movd 0(%1,%3), %%mm1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
170 "movd 4(%1,%3), %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
171 "add %3, %1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
172 "punpcklbw %%mm0, %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
173 "punpcklbw %%mm0, %%mm4 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
174 "punpcklbw %%mm0, %%mm1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
175 "punpcklbw %%mm0, %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
176 "paddw %%mm1, %%mm3 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
177 "paddw %%mm2, %%mm4 \n\t"
5938
7bc05f20e435 Typo fix. Previous version had some picture error building up until next keyframe.
gpoirier
parents: 5936
diff changeset
178 "movd 0(%1,%4), %%mm1 \n\t"
7bc05f20e435 Typo fix. Previous version had some picture error building up until next keyframe.
gpoirier
parents: 5936
diff changeset
179 "movd 4(%1,%4), %%mm2 \n\t"
5933
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
180 "pmullw %%mm6, %%mm3 \n\t" /* 0,9,9,0*/
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
181 "pmullw %%mm6, %%mm4 \n\t" /* 0,9,9,0*/
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
182 "punpcklbw %%mm0, %%mm1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
183 "punpcklbw %%mm0, %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
184 "psubw %%mm1, %%mm3 \n\t" /*-1,9,9,0*/
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
185 "psubw %%mm2, %%mm4 \n\t" /*-1,9,9,0*/
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
186 "movd 0(%1,%3), %%mm1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
187 "movd 4(%1,%3), %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
188 "punpcklbw %%mm0, %%mm1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
189 "punpcklbw %%mm0, %%mm2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
190 "psubw %%mm1, %%mm3 \n\t" /*-1,9,9,-1*/
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
191 "psubw %%mm2, %%mm4 \n\t" /*-1,9,9,-1*/
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
192 NORMALIZE_MMX("$4")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
193 TRANSFER_DO_PACK
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
194 "add %7, %1 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
195 "add %5, %2 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
196 "dec %0 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
197 "jnz 1b \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
198 : "+g"(h), "+r"(src), "+r"(dst)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
199 : "r"(offset), "r"(-2*offset), "g"(stride), "m"(rnd),
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
200 "g"(stride-offset), "m"(fact_9)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
201 : "memory"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
202 );
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
203 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
204
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
205 /**
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
206 * Filter coefficients made global to allow access by all 1 or 3 quarter shift
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
207 * interpolation functions.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
208 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
209 DECLARE_ALIGNED_16(static const uint64_t, fact_53) = 0x0035003500350035ULL;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
210 DECLARE_ALIGNED_16(static const uint64_t, fact_18) = 0x0012001200120012ULL;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
211
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
212 /**
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
213 * Core of the 1/4 and 3/4 shift bicubic interpolation.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
214 *
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
215 * @param UNPACK Macro unpacking arguments from 8 to 16bits (can be empty).
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
216 * @param MOVQ "movd 1" or "movq 2", if data read is already unpacked.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
217 * @param A1 Address of 1st tap (beware of unpacked/packed).
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
218 * @param A2 Address of 2nd tap
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
219 * @param A3 Address of 3rd tap
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
220 * @param A4 Address of 4th tap
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
221 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
222 #define MSPEL_FILTER13_CORE(UNPACK, MOVQ, A1, A2, A3, A4, POS) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
223 MOVQ "*0+"A1", %%mm1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
224 MOVQ "*4+"A1", %%mm2 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
225 UNPACK("%%mm1") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
226 UNPACK("%%mm2") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
227 "pmullw "POS", %%mm1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
228 "pmullw "POS", %%mm2 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
229 MOVQ "*0+"A2", %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
230 MOVQ "*4+"A2", %%mm4 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
231 UNPACK("%%mm3") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
232 UNPACK("%%mm4") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
233 "pmullw %%mm6, %%mm3 \n\t" /* *18 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
234 "pmullw %%mm6, %%mm4 \n\t" /* *18 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
235 "psubw %%mm1, %%mm3 \n\t" /* 18,-3 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
236 "psubw %%mm2, %%mm4 \n\t" /* 18,-3 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
237 MOVQ "*0+"A4", %%mm1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
238 MOVQ "*4+"A4", %%mm2 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
239 UNPACK("%%mm1") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
240 UNPACK("%%mm2") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
241 "psllw $2, %%mm1 \n\t" /* 4* */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
242 "psllw $2, %%mm2 \n\t" /* 4* */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
243 "psubw %%mm1, %%mm3 \n\t" /* -4,18,-3 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
244 "psubw %%mm2, %%mm4 \n\t" /* -4,18,-3 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
245 MOVQ "*0+"A3", %%mm1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
246 MOVQ "*4+"A3", %%mm2 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
247 UNPACK("%%mm1") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
248 UNPACK("%%mm2") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
249 "pmullw %%mm5, %%mm1 \n\t" /* *53 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
250 "pmullw %%mm5, %%mm2 \n\t" /* *53 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
251 "paddw %%mm1, %%mm3 \n\t" /* 4,53,18,-3 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
252 "paddw %%mm2, %%mm4 \n\t" /* 4,53,18,-3 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
253
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
254 /**
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
255 * Macro to build the vertical 16bits version of vc1_put_shift[13].
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
256 * Here, offset=src_stride. Parameters passed A1 to A4 must use
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
257 * %3 (src_stride) and %4 (3*src_stride).
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
258 *
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
259 * @param NAME Either 1 or 3
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
260 * @see MSPEL_FILTER13_CORE for information on A1->A4
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
261 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
262 #define MSPEL_FILTER13_VER_16B(NAME, A1, A2, A3, A4) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
263 static void \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
264 vc1_put_ver_16b_ ## NAME ## _mmx(int16_t *dst, const uint8_t *src, \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
265 long int src_stride, \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
266 int rnd, int64_t shift) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
267 { \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
268 int h = 8; \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
269 src -= src_stride; \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
270 asm volatile( \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
271 LOAD_ROUNDER_MMX("%5") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
272 "movq %7, %%mm5 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
273 "movq %8, %%mm6 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
274 ASMALIGN(3) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
275 "1: \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
276 MSPEL_FILTER13_CORE(DO_UNPACK, "movd 1", A1, A2, A3, A4, "%9") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
277 NORMALIZE_MMX("%6") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
278 TRANSFER_DONT_PACK \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
279 /* Last 3 (in fact 4) bytes on the line */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
280 "movd 8+"A1", %%mm1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
281 DO_UNPACK("%%mm1") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
282 "movq %%mm1, %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
283 "paddw %%mm1, %%mm1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
284 "paddw %%mm3, %%mm1 \n\t" /* 3* */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
285 "movd 8+"A2", %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
286 DO_UNPACK("%%mm3") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
287 "pmullw %%mm6, %%mm3 \n\t" /* *18 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
288 "psubw %%mm1, %%mm3 \n\t" /*18,-3 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
289 "movd 8+"A3", %%mm1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
290 DO_UNPACK("%%mm1") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
291 "pmullw %%mm5, %%mm1 \n\t" /* *53 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
292 "paddw %%mm1, %%mm3 \n\t" /*53,18,-3 */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
293 "movd 8+"A4", %%mm1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
294 DO_UNPACK("%%mm1") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
295 "psllw $2, %%mm1 \n\t" /* 4* */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
296 "psubw %%mm1, %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
297 "paddw %%mm7, %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
298 "psraw %6, %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
299 "movq %%mm3, 16(%2) \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
300 "add %3, %1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
301 "add $24, %2 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
302 "dec %0 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
303 "jnz 1b \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
304 : "+g"(h), "+r" (src), "+r" (dst) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
305 : "r"(src_stride), "r"(3*src_stride), \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
306 "m"(rnd), "m"(shift), \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
307 "m"(fact_53), "m"(fact_18), "m"(ff_pw_3) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
308 : "memory" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
309 ); \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
310 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
311
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
312 /**
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
313 * Macro to build the horizontal 16bits version of vc1_put_shift[13].
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
314 * Here, offset=16bits, so parameters passed A1 to A4 should be simple.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
315 *
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
316 * @param NAME Either 1 or 3
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
317 * @see MSPEL_FILTER13_CORE for information on A1->A4
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
318 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
319 #define MSPEL_FILTER13_HOR_16B(NAME, A1, A2, A3, A4) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
320 static void \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
321 vc1_put_hor_16b_ ## NAME ## _mmx(uint8_t *dst, long int stride, \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
322 const int16_t *src, int rnd) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
323 { \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
324 int h = 8; \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
325 src -= 1; \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
326 rnd -= (-4+58+13-3)*256; /* Add -256 bias */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
327 asm volatile( \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
328 LOAD_ROUNDER_MMX("%4") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
329 "movq %6, %%mm6 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
330 "movq %5, %%mm5 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
331 ASMALIGN(3) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
332 "1: \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
333 MSPEL_FILTER13_CORE(DONT_UNPACK, "movq 2", A1, A2, A3, A4, "%8")\
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
334 NORMALIZE_MMX("$7") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
335 /* Remove bias */ \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
336 "paddw %7, %%mm3 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
337 "paddw %7, %%mm4 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
338 TRANSFER_DO_PACK \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
339 "add $24, %1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
340 "add %3, %2 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
341 "dec %0 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
342 "jnz 1b \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
343 : "+g"(h), "+r" (src), "+r" (dst) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
344 : "g"(stride), "m"(rnd), "m"(fact_53), "m"(fact_18), \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
345 "m"(ff_pw_128), "m"(ff_pw_3) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
346 : "memory" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
347 ); \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
348 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
349
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
350 /**
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
351 * Macro to build the 8bits, any direction, version of vc1_put_shift[13].
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
352 * Here, offset=src_stride. Parameters passed A1 to A4 must use
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
353 * %3 (offset) and %4 (3*offset).
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
354 *
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
355 * @param NAME Either 1 or 3
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
356 * @see MSPEL_FILTER13_CORE for information on A1->A4
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
357 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
358 #define MSPEL_FILTER13_8B(NAME, A1, A2, A3, A4) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
359 static void \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
360 vc1_put_## NAME ## _mmx(uint8_t *dst, const uint8_t *src, \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
361 long int stride, int rnd, long int offset) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
362 { \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
363 int h = 8; \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
364 src -= offset; \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
365 rnd = 32-rnd; \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
366 asm volatile ( \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
367 LOAD_ROUNDER_MMX("%6") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
368 "movq %7, %%mm5 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
369 "movq %8, %%mm6 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
370 ASMALIGN(3) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
371 "1: \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
372 MSPEL_FILTER13_CORE(DO_UNPACK, "movd 1", A1, A2, A3, A4, "%9")\
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
373 NORMALIZE_MMX("$6") \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
374 TRANSFER_DO_PACK \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
375 "add %5, %1 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
376 "add %5, %2 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
377 "dec %0 \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
378 "jnz 1b \n\t" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
379 : "+g"(h), "+r" (src), "+r" (dst) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
380 : "r"(offset), "r"(3*offset), "g"(stride), "m"(rnd), \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
381 "m"(fact_53), "m"(fact_18), "m"(ff_pw_3) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
382 : "memory" \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
383 ); \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
384 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
385
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
386 /** 1/4 shift bicubic interpolation */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
387 MSPEL_FILTER13_8B (shift1, "0(%1,%4 )", "0(%1,%3,2)", "0(%1,%3 )", "0(%1 )")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
388 MSPEL_FILTER13_VER_16B(shift1, "0(%1,%4 )", "0(%1,%3,2)", "0(%1,%3 )", "0(%1 )")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
389 MSPEL_FILTER13_HOR_16B(shift1, "2*3(%1)", "2*2(%1)", "2*1(%1)", "2*0(%1)")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
390
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
391 /** 3/4 shift bicubic interpolation */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
392 MSPEL_FILTER13_8B (shift3, "0(%1 )", "0(%1,%3 )", "0(%1,%3,2)", "0(%1,%4 )")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
393 MSPEL_FILTER13_VER_16B(shift3, "0(%1 )", "0(%1,%3 )", "0(%1,%3,2)", "0(%1,%4 )")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
394 MSPEL_FILTER13_HOR_16B(shift3, "2*0(%1)", "2*1(%1)", "2*2(%1)", "2*3(%1)")
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
395
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
396 typedef void (*vc1_mspel_mc_filter_ver_16bits)(int16_t *dst, const uint8_t *src, long int src_stride, int rnd, int64_t shift);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
397 typedef void (*vc1_mspel_mc_filter_hor_16bits)(uint8_t *dst, long int dst_stride, const int16_t *src, int rnd);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
398 typedef void (*vc1_mspel_mc_filter_8bits)(uint8_t *dst, const uint8_t *src, long int stride, int rnd, long int offset);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
399
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
400 /**
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
401 * Interpolates fractional pel values by applying proper vertical then
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
402 * horizontal filter.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
403 *
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
404 * @param dst Destination buffer for interpolated pels.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
405 * @param src Source buffer.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
406 * @param stride Stride for both src and dst buffers.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
407 * @param hmode Horizontal filter (expressed in quarter pixels shift).
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
408 * @param hmode Vertical filter.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
409 * @param rnd Rounding bias.
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
410 */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
411 static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride,
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
412 int hmode, int vmode, int rnd)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
413 {
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
414 static const vc1_mspel_mc_filter_ver_16bits vc1_put_shift_ver_16bits[] =
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
415 { NULL, vc1_put_ver_16b_shift1_mmx, vc1_put_ver_16b_shift2_mmx, vc1_put_ver_16b_shift3_mmx };
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
416 static const vc1_mspel_mc_filter_hor_16bits vc1_put_shift_hor_16bits[] =
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
417 { NULL, vc1_put_hor_16b_shift1_mmx, vc1_put_hor_16b_shift2_mmx, vc1_put_hor_16b_shift3_mmx };
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
418 static const vc1_mspel_mc_filter_8bits vc1_put_shift_8bits[] =
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
419 { NULL, vc1_put_shift1_mmx, vc1_put_shift2_mmx, vc1_put_shift3_mmx };
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
420
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
421 asm volatile(
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
422 "pxor %%mm0, %%mm0 \n\t"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
423 ::: "memory"
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
424 );
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
425
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
426 if (vmode) { /* Vertical filter to apply */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
427 if (hmode) { /* Horizontal filter to apply, output to tmp */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
428 static const int shift_value[] = { 0, 5, 1, 5 };
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
429 int shift = (shift_value[hmode]+shift_value[vmode])>>1;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
430 int r;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
431 DECLARE_ALIGNED_16(int16_t, tmp[12*8]);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
432
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
433 r = (1<<(shift-1)) + rnd-1;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
434 vc1_put_shift_ver_16bits[vmode](tmp, src-1, stride, r, shift);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
435
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
436 vc1_put_shift_hor_16bits[hmode](dst, stride, tmp+1, 64-rnd);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
437 return;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
438 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
439 else { /* No horizontal filter, output 8 lines to dst */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
440 vc1_put_shift_8bits[vmode](dst, src, stride, 1-rnd, stride);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
441 return;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
442 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
443 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
444
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
445 /* Horizontal mode with no vertical mode */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
446 vc1_put_shift_8bits[hmode](dst, src, stride, rnd, 1);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
447 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
448
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
449 static void put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
450 put_pixels8_mmx(dst, src, stride, 8);
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
451 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
452
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
453 /** Macro to ease bicubic filter interpolation functions declarations */
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
454 #define DECLARE_FUNCTION(a, b) \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
455 static void put_vc1_mspel_mc ## a ## b ## _mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
456 vc1_mspel_mc(dst, src, stride, a, b, rnd); \
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
457 }
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
458
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
459 DECLARE_FUNCTION(0, 1)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
460 DECLARE_FUNCTION(0, 2)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
461 DECLARE_FUNCTION(0, 3)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
462
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
463 DECLARE_FUNCTION(1, 0)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
464 DECLARE_FUNCTION(1, 1)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
465 DECLARE_FUNCTION(1, 2)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
466 DECLARE_FUNCTION(1, 3)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
467
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
468 DECLARE_FUNCTION(2, 0)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
469 DECLARE_FUNCTION(2, 1)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
470 DECLARE_FUNCTION(2, 2)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
471 DECLARE_FUNCTION(2, 3)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
472
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
473 DECLARE_FUNCTION(3, 0)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
474 DECLARE_FUNCTION(3, 1)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
475 DECLARE_FUNCTION(3, 2)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
476 DECLARE_FUNCTION(3, 3)
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
477
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
478 void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) {
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
479 dsp->put_vc1_mspel_pixels_tab[ 0] = put_vc1_mspel_mc00_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
480 dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
481 dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
482 dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
483
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
484 dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
485 dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
486 dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
487 dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
488
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
489 dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
490 dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
491 dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
492 dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
493
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
494 dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
495 dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
496 dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
497 dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
6ce8f15fc02b add VC-1 MMX DSP functions, under MIT license.
gpoirier
parents:
diff changeset
498 }