annotate libmpcodecs/cmmx.h @ 33222:6b403270ab08

Remove unnecessary #ifdef.
author ib
date Sat, 23 Apr 2011 09:41:48 +0000
parents 7af3e6f901fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11600
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
1 /*
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
2 * x86 MMX and MMX2 packed byte operations in portable C.
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
3 * Extra instructions: pdiffub, pcmpzb, psumbw, pcmpgtub
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
4 * Author: Zoltan Hidvegi
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
5 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
6 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
7 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
9 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
11 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
12 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
16 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
17 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
18 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 26029
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
11600
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
21 */
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
22
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
23 #ifndef MPLAYER_CMMX_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
24 #define MPLAYER_CMMX_H
11600
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
25
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
26 typedef unsigned long cmmx_t;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
27
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
28 #define ONE_BYTES (~(cmmx_t)0 / 255)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
29 #define SIGN_BITS (ONE_BYTES << 7)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
30 #define LOWBW_MASK (~(cmmx_t)0 / 257)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
31
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
32 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
33 paddb(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
34 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
35 return ((a & ~SIGN_BITS) + (b & ~SIGN_BITS)) ^ ((a^b) & SIGN_BITS);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
36 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
37
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
38 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
39 psubb(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
40 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
41 return ((a | SIGN_BITS) - (b & ~SIGN_BITS)) ^ (~(a^b) & SIGN_BITS);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
42 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
43
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
44 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
45 paddusb(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
46 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
47 cmmx_t s = (a & ~SIGN_BITS) + (b & ~SIGN_BITS);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
48 cmmx_t abs = (a | b) & SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
49 cmmx_t c = abs & (s | (a & b));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
50 return s | abs | (abs - (c >> 7));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
51 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
52
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
53 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
54 paddusb_s(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
55 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
56 cmmx_t sum = a+b;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
57 cmmx_t ov = sum & SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
58 return sum + (sum ^ (ov - (ov>>7)));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
59 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
60
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
61 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
62 psubusb(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
63 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
64 cmmx_t s = (a | SIGN_BITS) - (b & ~SIGN_BITS);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
65 cmmx_t anb = a & ~b;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
66 cmmx_t c = (anb | (s & ~(a^b))) & SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
67 return s & ((c & anb) | (c - (c >> 7)));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
68 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
69
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
70 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
71 psubusb_s(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
72 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
73 cmmx_t d = (a|SIGN_BITS) - b;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
74 cmmx_t m = d & SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
75 return d & (m - (m>>7));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
76 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
77
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
78 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
79 pcmpgtub(cmmx_t b, cmmx_t a)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
80 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
81 cmmx_t s = (a | SIGN_BITS) - (b & ~SIGN_BITS);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
82 cmmx_t ret = ((~a & b) | (~s & ~(a ^ b))) & SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
83 return ret | (ret - (ret >> 7));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
84 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
85
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
86 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
87 pdiffub(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
88 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
89 cmmx_t xs = (~a ^ b) & SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
90 cmmx_t s = ((a | SIGN_BITS) - (b & ~SIGN_BITS)) ^ xs;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
91 cmmx_t gt = ((~a & b) | (s & xs)) & SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
92 cmmx_t gt7 = gt >> 7;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
93 return (s ^ gt ^ (gt - gt7)) + gt7;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
94 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
95
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
96 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
97 pdiffub_s(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
98 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
99 cmmx_t d = (a|SIGN_BITS) - b;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
100 cmmx_t g = (~d & SIGN_BITS) >> 7;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
101 return (d ^ (SIGN_BITS-g)) + g;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
102 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
103
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
104 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
105 pmaxub(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
106 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
107 return psubusb(a,b) + b;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
108 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
109
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
110 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
111 pminub(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
112 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
113 return paddusb(a,~b) - ~b;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
114 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
115
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
116 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
117 pminub_s(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
118 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
119 cmmx_t d = (a|SIGN_BITS) - b;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
120 cmmx_t m = ~SIGN_BITS + ((d&SIGN_BITS)>>7);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
121 return ((d&m) + b) & ~SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
122 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
123
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
124 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
125 pavgb(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
126 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
127 cmmx_t ao = a & ONE_BYTES;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
128 cmmx_t bo = b & ONE_BYTES;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
129 return ((a^ao)>>1) + ((b^bo)>>1) + (ao|bo);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
130 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
131
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
132 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
133 pavgb_s(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
134 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
135 return ((a+b+ONE_BYTES)>>1) & ~SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
136 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
137
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
138 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
139 p31avgb(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
140 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
141 cmmx_t ao = a & (3*ONE_BYTES);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
142 cmmx_t bo = b & (3*ONE_BYTES);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
143 return 3*((a^ao)>>2) + ((b^bo)>>2) +
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30421
diff changeset
144 (((3*ao+bo+2*ONE_BYTES)>>2) & (3*ONE_BYTES));
11600
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
145 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
146
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
147 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
148 p31avgb_s(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
149 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
150 cmmx_t avg = ((a+b)>>1) & ~SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
151 return pavgb_s(avg, a);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
152 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
153
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
154 static inline unsigned long
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
155 psumbw(cmmx_t a)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
156 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
157 cmmx_t t = (a & LOWBW_MASK) + ((a>>8) & LOWBW_MASK);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
158 unsigned long ret =
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30421
diff changeset
159 (unsigned long)t + (unsigned long)(t >> (4*sizeof(cmmx_t)));
11600
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
160 if (sizeof(cmmx_t) > 4)
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30421
diff changeset
161 ret += ret >> 16;
11600
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
162 return ret & 0xffff;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
163 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
164
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
165 static inline unsigned long
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
166 psumbw_s(cmmx_t a)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
167 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
168 unsigned long ret =
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30421
diff changeset
169 (unsigned long)a + (unsigned long)(a >> (4*sizeof(cmmx_t)));
11600
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
170 if (sizeof(cmmx_t) <= 4)
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30421
diff changeset
171 return (ret & 0xff) + ((ret>>8) & 0xff);
11600
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
172 ret = (ret & 0xff00ff) + ((ret>>8) & 0xff00ff);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
173 ret += ret >> 16;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
174 return ret & 0xffff;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
175 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
176
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
177 static inline unsigned long
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
178 psadbw(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
179 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
180 return psumbw(pdiffub(a,b));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
181 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
182
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
183 static inline unsigned long
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
184 psadbw_s(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
185 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
186 return psumbw_s(pdiffub_s(a,b));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
187 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
188
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
189 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
190 pcmpzb(cmmx_t a)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
191 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
192 cmmx_t ret = (((a | SIGN_BITS) - ONE_BYTES) | a) & SIGN_BITS;
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
193 return ~(ret | (ret - (ret >> 7)));
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
194 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
195
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
196 static inline cmmx_t
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
197 pcmpeqb(cmmx_t a, cmmx_t b)
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
198 {
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
199 return pcmpzb(a ^ b);
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
200 }
5eb66d37d539 Yet another inverse telecine filter by Zoltan Hidvegi <mplayer@hzoli.2y.net>. Also heavily MMX centric.
alex
parents:
diff changeset
201
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
202 #endif /* MPLAYER_CMMX_H */