Mercurial > libavcodec.hg
annotate dsputil.c @ 11430:b1b2215cb7c7 libavcodec
vp3: correctly clip vp3_draw_horiz_band call
author | conrad |
---|---|
date | Tue, 09 Mar 2010 06:52:33 +0000 |
parents | 8f061327e46a |
children | 5fe3559e8e71 |
rev | line source |
---|---|
0 | 1 /* |
2 * DSP utils | |
8629
04423b2f6e0b
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
8627
diff
changeset
|
3 * Copyright (c) 2000, 2001 Fabrice Bellard |
1739
07a484280a82
copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents:
1729
diff
changeset
|
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> |
0 | 5 * |
5214 | 6 * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni@gmx.at> |
7 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3807
diff
changeset
|
8 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3807
diff
changeset
|
9 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3807
diff
changeset
|
10 * FFmpeg is free software; you can redistribute it and/or |
429 | 11 * modify it under the terms of the GNU Lesser General Public |
12 * License as published by the Free Software Foundation; either | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3807
diff
changeset
|
13 * version 2.1 of the License, or (at your option) any later version. |
0 | 14 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3807
diff
changeset
|
15 * FFmpeg is distributed in the hope that it will be useful, |
0 | 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 * Lesser General Public License for more details. | |
0 | 19 * |
429 | 20 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3807
diff
changeset
|
21 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
3029
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 23 */ |
2967 | 24 |
1106 | 25 /** |
8718
e9d9d946f213
Use full internal pathname in doxygen @file directives.
diego
parents:
8629
diff
changeset
|
26 * @file libavcodec/dsputil.c |
1106 | 27 * DSP utils |
28 */ | |
2967 | 29 |
0 | 30 #include "avcodec.h" |
31 #include "dsputil.h" | |
1092 | 32 #include "simple_idct.h" |
1557 | 33 #include "faandct.h" |
6407 | 34 #include "faanidct.h" |
8627
d6bab465b82c
moves mid_pred() into mathops.h (with arch specific code split by directory)
aurel
parents:
8596
diff
changeset
|
35 #include "mathops.h" |
3198
6b9f0c4fbdbe
First part of a series of speed-enchancing patches.
gpoirier
parents:
3105
diff
changeset
|
36 #include "snow.h" |
10748
36611425fedb
Add required header #includes for mpegvideo.h and config.h.
diego
parents:
10644
diff
changeset
|
37 #include "mpegvideo.h" |
36611425fedb
Add required header #includes for mpegvideo.h and config.h.
diego
parents:
10644
diff
changeset
|
38 #include "config.h" |
11375
84963c795459
Move some prototypes from dsputil.c to reasonable header files
mru
parents:
11369
diff
changeset
|
39 #include "lpc.h" |
84963c795459
Move some prototypes from dsputil.c to reasonable header files
mru
parents:
11369
diff
changeset
|
40 #include "ac3dec.h" |
84963c795459
Move some prototypes from dsputil.c to reasonable header files
mru
parents:
11369
diff
changeset
|
41 #include "vorbis.h" |
84963c795459
Move some prototypes from dsputil.c to reasonable header files
mru
parents:
11369
diff
changeset
|
42 #include "png.h" |
676 | 43 |
4176 | 44 uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, }; |
4179 | 45 uint32_t ff_squareTbl[512] = {0, }; |
0 | 46 |
6387 | 47 // 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size |
48 #define pb_7f (~0UL/255 * 0x7f) | |
49 #define pb_80 (~0UL/255 * 0x80) | |
6385 | 50 |
1064 | 51 const uint8_t ff_zigzag_direct[64] = { |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
689
diff
changeset
|
52 0, 1, 8, 16, 9, 2, 3, 10, |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
689
diff
changeset
|
53 17, 24, 32, 25, 18, 11, 4, 5, |
34 | 54 12, 19, 26, 33, 40, 48, 41, 34, |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
689
diff
changeset
|
55 27, 20, 13, 6, 7, 14, 21, 28, |
34 | 56 35, 42, 49, 56, 57, 50, 43, 36, |
57 29, 22, 15, 23, 30, 37, 44, 51, | |
58 58, 59, 52, 45, 38, 31, 39, 46, | |
59 53, 60, 61, 54, 47, 55, 62, 63 | |
60 }; | |
61 | |
1567 | 62 /* Specific zigzag scan for 248 idct. NOTE that unlike the |
63 specification, we interleave the fields */ | |
64 const uint8_t ff_zigzag248_direct[64] = { | |
65 0, 8, 1, 9, 16, 24, 2, 10, | |
66 17, 25, 32, 40, 48, 56, 33, 41, | |
67 18, 26, 3, 11, 4, 12, 19, 27, | |
68 34, 42, 49, 57, 50, 58, 35, 43, | |
69 20, 28, 5, 13, 6, 14, 21, 29, | |
70 36, 44, 51, 59, 52, 60, 37, 45, | |
71 22, 30, 7, 15, 23, 31, 38, 46, | |
72 53, 61, 54, 62, 39, 47, 55, 63, | |
73 }; | |
74 | |
220 | 75 /* not permutated inverse zigzag_direct + 1 for MMX quantizer */ |
11369 | 76 DECLARE_ALIGNED(16, uint16_t, inv_zigzag_direct16)[64]; |
220 | 77 |
1064 | 78 const uint8_t ff_alternate_horizontal_scan[64] = { |
2967 | 79 0, 1, 2, 3, 8, 9, 16, 17, |
34 | 80 10, 11, 4, 5, 6, 7, 15, 14, |
2967 | 81 13, 12, 19, 18, 24, 25, 32, 33, |
34 | 82 26, 27, 20, 21, 22, 23, 28, 29, |
2967 | 83 30, 31, 34, 35, 40, 41, 48, 49, |
34 | 84 42, 43, 36, 37, 38, 39, 44, 45, |
2967 | 85 46, 47, 50, 51, 56, 57, 58, 59, |
34 | 86 52, 53, 54, 55, 60, 61, 62, 63, |
87 }; | |
88 | |
1064 | 89 const uint8_t ff_alternate_vertical_scan[64] = { |
2967 | 90 0, 8, 16, 24, 1, 9, 2, 10, |
34 | 91 17, 25, 32, 40, 48, 56, 57, 49, |
2967 | 92 41, 33, 26, 18, 3, 11, 4, 12, |
34 | 93 19, 27, 34, 42, 50, 58, 35, 43, |
2967 | 94 51, 59, 20, 28, 5, 13, 6, 14, |
34 | 95 21, 29, 36, 44, 52, 60, 37, 45, |
2967 | 96 53, 61, 22, 30, 7, 15, 23, 31, |
34 | 97 38, 46, 54, 62, 39, 47, 55, 63, |
98 }; | |
99 | |
10207 | 100 /* a*inverse[b]>>32 == a/b for all 0<=a<=16909558 && 2<=b<=256 |
101 * for a>16909558, is an overestimate by less than 1 part in 1<<24 */ | |
102 const uint32_t ff_inverse[257]={ | |
2967 | 103 0, 4294967295U,2147483648U,1431655766, 1073741824, 858993460, 715827883, 613566757, |
104 536870912, 477218589, 429496730, 390451573, 357913942, 330382100, 306783379, 286331154, | |
105 268435456, 252645136, 238609295, 226050911, 214748365, 204522253, 195225787, 186737709, | |
106 178956971, 171798692, 165191050, 159072863, 153391690, 148102321, 143165577, 138547333, | |
107 134217728, 130150525, 126322568, 122713352, 119304648, 116080198, 113025456, 110127367, | |
108 107374183, 104755300, 102261127, 99882961, 97612894, 95443718, 93368855, 91382283, | |
109 89478486, 87652394, 85899346, 84215046, 82595525, 81037119, 79536432, 78090315, | |
110 76695845, 75350304, 74051161, 72796056, 71582789, 70409300, 69273667, 68174085, | |
111 67108864, 66076420, 65075263, 64103990, 63161284, 62245903, 61356676, 60492498, | |
112 59652324, 58835169, 58040099, 57266231, 56512728, 55778797, 55063684, 54366675, | |
113 53687092, 53024288, 52377650, 51746594, 51130564, 50529028, 49941481, 49367441, | |
114 48806447, 48258060, 47721859, 47197443, 46684428, 46182445, 45691142, 45210183, | |
115 44739243, 44278014, 43826197, 43383509, 42949673, 42524429, 42107523, 41698712, | |
116 41297763, 40904451, 40518560, 40139882, 39768216, 39403370, 39045158, 38693400, | |
117 38347923, 38008561, 37675152, 37347542, 37025581, 36709123, 36398028, 36092163, | |
118 35791395, 35495598, 35204650, 34918434, 34636834, 34359739, 34087043, 33818641, | |
119 33554432, 33294321, 33038210, 32786010, 32537632, 32292988, 32051995, 31814573, | |
120 31580642, 31350127, 31122952, 30899046, 30678338, 30460761, 30246249, 30034737, | |
121 29826162, 29620465, 29417585, 29217465, 29020050, 28825284, 28633116, 28443493, | |
122 28256364, 28071682, 27889399, 27709467, 27531842, 27356480, 27183338, 27012373, | |
123 26843546, 26676816, 26512144, 26349493, 26188825, 26030105, 25873297, 25718368, | |
124 25565282, 25414008, 25264514, 25116768, 24970741, 24826401, 24683721, 24542671, | |
125 24403224, 24265352, 24129030, 23994231, 23860930, 23729102, 23598722, 23469767, | |
126 23342214, 23216040, 23091223, 22967740, 22845571, 22724695, 22605092, 22486740, | |
127 22369622, 22253717, 22139007, 22025474, 21913099, 21801865, 21691755, 21582751, | |
128 21474837, 21367997, 21262215, 21157475, 21053762, 20951060, 20849356, 20748635, | |
129 20648882, 20550083, 20452226, 20355296, 20259280, 20164166, 20069941, 19976593, | |
130 19884108, 19792477, 19701685, 19611723, 19522579, 19434242, 19346700, 19259944, | |
131 19173962, 19088744, 19004281, 18920561, 18837576, 18755316, 18673771, 18592933, | |
132 18512791, 18433337, 18354562, 18276457, 18199014, 18122225, 18046082, 17970575, | |
133 17895698, 17821442, 17747799, 17674763, 17602325, 17530479, 17459217, 17388532, | |
220 | 134 17318417, 17248865, 17179870, 17111424, 17043522, 16976156, 16909321, 16843010, |
10207 | 135 16777216 |
220 | 136 }; |
137 | |
1092 | 138 /* Input permutation for the simple_idct_mmx */ |
139 static const uint8_t simple_mmx_permutation[64]={ | |
2979 | 140 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D, |
141 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D, | |
142 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D, | |
143 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F, | |
144 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F, | |
145 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, | |
146 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, | |
147 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F, | |
1092 | 148 }; |
149 | |
6600
c3213c91124c
Add a new IDCT permutation, used in xvid_sse2 and possibly future similar IDCTs.
astrange
parents:
6450
diff
changeset
|
150 static const uint8_t idct_sse2_row_perm[8] = {0, 4, 1, 5, 2, 6, 3, 7}; |
c3213c91124c
Add a new IDCT permutation, used in xvid_sse2 and possibly future similar IDCTs.
astrange
parents:
6450
diff
changeset
|
151 |
6438 | 152 void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable){ |
153 int i; | |
154 int end; | |
155 | |
156 st->scantable= src_scantable; | |
157 | |
158 for(i=0; i<64; i++){ | |
159 int j; | |
160 j = src_scantable[i]; | |
161 st->permutated[i] = permutation[j]; | |
8590 | 162 #if ARCH_PPC |
6438 | 163 st->inverse[j] = i; |
164 #endif | |
165 } | |
166 | |
167 end=-1; | |
168 for(i=0; i<64; i++){ | |
169 int j; | |
170 j = st->permutated[i]; | |
171 if(j>end) end=j; | |
172 st->raster_end[i]= end; | |
173 } | |
174 } | |
175 | |
1064 | 176 static int pix_sum_c(uint8_t * pix, int line_size) |
612 | 177 { |
178 int s, i, j; | |
179 | |
180 s = 0; | |
181 for (i = 0; i < 16; i++) { | |
2979 | 182 for (j = 0; j < 16; j += 8) { |
183 s += pix[0]; | |
184 s += pix[1]; | |
185 s += pix[2]; | |
186 s += pix[3]; | |
187 s += pix[4]; | |
188 s += pix[5]; | |
189 s += pix[6]; | |
190 s += pix[7]; | |
191 pix += 8; | |
192 } | |
193 pix += line_size - 16; | |
612 | 194 } |
195 return s; | |
196 } | |
197 | |
1064 | 198 static int pix_norm1_c(uint8_t * pix, int line_size) |
612 | 199 { |
200 int s, i, j; | |
4179 | 201 uint32_t *sq = ff_squareTbl + 256; |
612 | 202 |
203 s = 0; | |
204 for (i = 0; i < 16; i++) { | |
2979 | 205 for (j = 0; j < 16; j += 8) { |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
206 #if 0 |
2979 | 207 s += sq[pix[0]]; |
208 s += sq[pix[1]]; | |
209 s += sq[pix[2]]; | |
210 s += sq[pix[3]]; | |
211 s += sq[pix[4]]; | |
212 s += sq[pix[5]]; | |
213 s += sq[pix[6]]; | |
214 s += sq[pix[7]]; | |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
215 #else |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
216 #if LONG_MAX > 2147483647 |
2979 | 217 register uint64_t x=*(uint64_t*)pix; |
218 s += sq[x&0xff]; | |
219 s += sq[(x>>8)&0xff]; | |
220 s += sq[(x>>16)&0xff]; | |
221 s += sq[(x>>24)&0xff]; | |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
222 s += sq[(x>>32)&0xff]; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
223 s += sq[(x>>40)&0xff]; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
224 s += sq[(x>>48)&0xff]; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
225 s += sq[(x>>56)&0xff]; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
226 #else |
2979 | 227 register uint32_t x=*(uint32_t*)pix; |
228 s += sq[x&0xff]; | |
229 s += sq[(x>>8)&0xff]; | |
230 s += sq[(x>>16)&0xff]; | |
231 s += sq[(x>>24)&0xff]; | |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
232 x=*(uint32_t*)(pix+4); |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
233 s += sq[x&0xff]; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
234 s += sq[(x>>8)&0xff]; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
235 s += sq[(x>>16)&0xff]; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
236 s += sq[(x>>24)&0xff]; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
237 #endif |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
238 #endif |
2979 | 239 pix += 8; |
240 } | |
241 pix += line_size - 16; | |
612 | 242 } |
243 return s; | |
244 } | |
245 | |
6241 | 246 static void bswap_buf(uint32_t *dst, const uint32_t *src, int w){ |
1273 | 247 int i; |
2967 | 248 |
1273 | 249 for(i=0; i+8<=w; i+=8){ |
250 dst[i+0]= bswap_32(src[i+0]); | |
251 dst[i+1]= bswap_32(src[i+1]); | |
252 dst[i+2]= bswap_32(src[i+2]); | |
253 dst[i+3]= bswap_32(src[i+3]); | |
254 dst[i+4]= bswap_32(src[i+4]); | |
255 dst[i+5]= bswap_32(src[i+5]); | |
256 dst[i+6]= bswap_32(src[i+6]); | |
257 dst[i+7]= bswap_32(src[i+7]); | |
258 } | |
259 for(;i<w; i++){ | |
260 dst[i+0]= bswap_32(src[i+0]); | |
261 } | |
262 } | |
612 | 263 |
2184 | 264 static int sse4_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) |
265 { | |
266 int s, i; | |
4179 | 267 uint32_t *sq = ff_squareTbl + 256; |
2184 | 268 |
269 s = 0; | |
270 for (i = 0; i < h; i++) { | |
271 s += sq[pix1[0] - pix2[0]]; | |
272 s += sq[pix1[1] - pix2[1]]; | |
273 s += sq[pix1[2] - pix2[2]]; | |
274 s += sq[pix1[3] - pix2[3]]; | |
275 pix1 += line_size; | |
276 pix2 += line_size; | |
277 } | |
278 return s; | |
279 } | |
280 | |
1708 | 281 static int sse8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) |
936 | 282 { |
283 int s, i; | |
4179 | 284 uint32_t *sq = ff_squareTbl + 256; |
936 | 285 |
286 s = 0; | |
1708 | 287 for (i = 0; i < h; i++) { |
936 | 288 s += sq[pix1[0] - pix2[0]]; |
289 s += sq[pix1[1] - pix2[1]]; | |
290 s += sq[pix1[2] - pix2[2]]; | |
291 s += sq[pix1[3] - pix2[3]]; | |
292 s += sq[pix1[4] - pix2[4]]; | |
293 s += sq[pix1[5] - pix2[5]]; | |
294 s += sq[pix1[6] - pix2[6]]; | |
295 s += sq[pix1[7] - pix2[7]]; | |
296 pix1 += line_size; | |
297 pix2 += line_size; | |
298 } | |
299 return s; | |
300 } | |
301 | |
1708 | 302 static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
884 | 303 { |
1012
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
304 int s, i; |
4179 | 305 uint32_t *sq = ff_squareTbl + 256; |
884 | 306 |
307 s = 0; | |
1708 | 308 for (i = 0; i < h; i++) { |
1012
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
309 s += sq[pix1[ 0] - pix2[ 0]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
310 s += sq[pix1[ 1] - pix2[ 1]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
311 s += sq[pix1[ 2] - pix2[ 2]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
312 s += sq[pix1[ 3] - pix2[ 3]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
313 s += sq[pix1[ 4] - pix2[ 4]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
314 s += sq[pix1[ 5] - pix2[ 5]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
315 s += sq[pix1[ 6] - pix2[ 6]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
316 s += sq[pix1[ 7] - pix2[ 7]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
317 s += sq[pix1[ 8] - pix2[ 8]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
318 s += sq[pix1[ 9] - pix2[ 9]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
319 s += sq[pix1[10] - pix2[10]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
320 s += sq[pix1[11] - pix2[11]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
321 s += sq[pix1[12] - pix2[12]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
322 s += sq[pix1[13] - pix2[13]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
323 s += sq[pix1[14] - pix2[14]]; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
324 s += sq[pix1[15] - pix2[15]]; |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
996
diff
changeset
|
325 |
1012
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
326 pix1 += line_size; |
7a5038ec769b
sse16_c is totally fucked up (unaligned loads, LONG_MAX is undefined,
mellum
parents:
1011
diff
changeset
|
327 pix2 += line_size; |
884 | 328 } |
329 return s; | |
330 } | |
331 | |
2184 | 332 |
8590 | 333 #if CONFIG_SNOW_ENCODER //dwt is in snow.c |
2184 | 334 static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){ |
335 int s, i, j; | |
336 const int dec_count= w==8 ? 3 : 4; | |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
337 int tmp[32*32]; |
2184 | 338 int level, ori; |
2967 | 339 static const int scale[2][2][4][4]={ |
2184 | 340 { |
341 { | |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
342 // 9/7 8x8 dec=3 |
2184 | 343 {268, 239, 239, 213}, |
344 { 0, 224, 224, 152}, | |
345 { 0, 135, 135, 110}, | |
346 },{ | |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
347 // 9/7 16x16 or 32x32 dec=4 |
2184 | 348 {344, 310, 310, 280}, |
349 { 0, 320, 320, 228}, | |
350 { 0, 175, 175, 136}, | |
351 { 0, 129, 129, 102}, | |
352 } | |
353 },{ | |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
354 { |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
355 // 5/3 8x8 dec=3 |
2184 | 356 {275, 245, 245, 218}, |
357 { 0, 230, 230, 156}, | |
358 { 0, 138, 138, 113}, | |
359 },{ | |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
360 // 5/3 16x16 or 32x32 dec=4 |
2184 | 361 {352, 317, 317, 286}, |
362 { 0, 328, 328, 233}, | |
363 { 0, 180, 180, 140}, | |
364 { 0, 132, 132, 105}, | |
365 } | |
366 } | |
367 }; | |
368 | |
369 for (i = 0; i < h; i++) { | |
370 for (j = 0; j < w; j+=4) { | |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
371 tmp[32*i+j+0] = (pix1[j+0] - pix2[j+0])<<4; |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
372 tmp[32*i+j+1] = (pix1[j+1] - pix2[j+1])<<4; |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
373 tmp[32*i+j+2] = (pix1[j+2] - pix2[j+2])<<4; |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
374 tmp[32*i+j+3] = (pix1[j+3] - pix2[j+3])<<4; |
2184 | 375 } |
376 pix1 += line_size; | |
377 pix2 += line_size; | |
378 } | |
2639 | 379 |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
380 ff_spatial_dwt(tmp, w, h, 32, type, dec_count); |
2184 | 381 |
382 s=0; | |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
383 assert(w==h); |
2184 | 384 for(level=0; level<dec_count; level++){ |
385 for(ori= level ? 1 : 0; ori<4; ori++){ | |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
386 int size= w>>(dec_count-level); |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
387 int sx= (ori&1) ? size : 0; |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
388 int stride= 32<<(dec_count-level); |
2184 | 389 int sy= (ori&2) ? stride>>1 : 0; |
2967 | 390 |
2184 | 391 for(i=0; i<size; i++){ |
392 for(j=0; j<size; j++){ | |
393 int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori]; | |
4001 | 394 s += FFABS(v); |
2184 | 395 } |
396 } | |
397 } | |
398 } | |
2967 | 399 assert(s>=0); |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
400 return s>>9; |
2184 | 401 } |
402 | |
403 static int w53_8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ | |
404 return w_c(v, pix1, pix2, line_size, 8, h, 1); | |
405 } | |
406 | |
407 static int w97_8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ | |
408 return w_c(v, pix1, pix2, line_size, 8, h, 0); | |
409 } | |
410 | |
411 static int w53_16_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ | |
412 return w_c(v, pix1, pix2, line_size, 16, h, 1); | |
413 } | |
414 | |
415 static int w97_16_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ | |
416 return w_c(v, pix1, pix2, line_size, 16, h, 0); | |
417 } | |
418 | |
4197 | 419 int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
420 return w_c(v, pix1, pix2, line_size, 32, h, 1); |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
421 } |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
422 |
4197 | 423 int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
424 return w_c(v, pix1, pix2, line_size, 32, h, 0); |
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
425 } |
3373
b8996cc5ccae
Disable w53 and w97 cmp methods when snow encoder is disabled
gpoirier
parents:
3323
diff
changeset
|
426 #endif |
3323
87c54a3f8d19
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents:
3248
diff
changeset
|
427 |
6437 | 428 /* draw the edges of width 'w' of an image of size width, height */ |
429 //FIXME check that this is ok for mpeg4 interlaced | |
430 static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w) | |
431 { | |
432 uint8_t *ptr, *last_line; | |
433 int i; | |
434 | |
435 last_line = buf + (height - 1) * wrap; | |
436 for(i=0;i<w;i++) { | |
437 /* top and bottom */ | |
438 memcpy(buf - (i + 1) * wrap, buf, width); | |
439 memcpy(last_line + (i + 1) * wrap, last_line, width); | |
440 } | |
441 /* left and right */ | |
442 ptr = buf; | |
443 for(i=0;i<height;i++) { | |
444 memset(ptr - w, ptr[0], w); | |
445 memset(ptr + width, ptr[width-1], w); | |
446 ptr += wrap; | |
447 } | |
448 /* corners */ | |
449 for(i=0;i<w;i++) { | |
450 memset(buf - (i + 1) * wrap - w, buf[0], w); /* top left */ | |
451 memset(buf - (i + 1) * wrap + width, buf[width-1], w); /* top right */ | |
452 memset(last_line + (i + 1) * wrap - w, last_line[0], w); /* top left */ | |
453 memset(last_line + (i + 1) * wrap + width, last_line[width-1], w); /* top right */ | |
454 } | |
455 } | |
456 | |
6445 | 457 /** |
458 * Copies a rectangular area of samples to a temporary buffer and replicates the boarder samples. | |
459 * @param buf destination buffer | |
460 * @param src source buffer | |
461 * @param linesize number of bytes between 2 vertically adjacent samples in both the source and destination buffers | |
462 * @param block_w width of block | |
463 * @param block_h height of block | |
464 * @param src_x x coordinate of the top left sample of the block in the source buffer | |
465 * @param src_y y coordinate of the top left sample of the block in the source buffer | |
466 * @param w width of the source buffer | |
467 * @param h height of the source buffer | |
468 */ | |
469 void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w, int block_h, | |
470 int src_x, int src_y, int w, int h){ | |
471 int x, y; | |
472 int start_y, start_x, end_y, end_x; | |
473 | |
474 if(src_y>= h){ | |
475 src+= (h-1-src_y)*linesize; | |
476 src_y=h-1; | |
477 }else if(src_y<=-block_h){ | |
478 src+= (1-block_h-src_y)*linesize; | |
479 src_y=1-block_h; | |
480 } | |
481 if(src_x>= w){ | |
482 src+= (w-1-src_x); | |
483 src_x=w-1; | |
484 }else if(src_x<=-block_w){ | |
485 src+= (1-block_w-src_x); | |
486 src_x=1-block_w; | |
487 } | |
488 | |
489 start_y= FFMAX(0, -src_y); | |
490 start_x= FFMAX(0, -src_x); | |
491 end_y= FFMIN(block_h, h-src_y); | |
492 end_x= FFMIN(block_w, w-src_x); | |
493 | |
494 // copy existing part | |
495 for(y=start_y; y<end_y; y++){ | |
496 for(x=start_x; x<end_x; x++){ | |
497 buf[x + y*linesize]= src[x + y*linesize]; | |
498 } | |
499 } | |
500 | |
501 //top | |
502 for(y=0; y<start_y; y++){ | |
503 for(x=start_x; x<end_x; x++){ | |
504 buf[x + y*linesize]= buf[x + start_y*linesize]; | |
505 } | |
506 } | |
507 | |
508 //bottom | |
509 for(y=end_y; y<block_h; y++){ | |
510 for(x=start_x; x<end_x; x++){ | |
511 buf[x + y*linesize]= buf[x + (end_y-1)*linesize]; | |
512 } | |
513 } | |
514 | |
515 for(y=0; y<block_h; y++){ | |
516 //left | |
517 for(x=0; x<start_x; x++){ | |
518 buf[x + y*linesize]= buf[start_x + y*linesize]; | |
519 } | |
520 | |
521 //right | |
522 for(x=end_x; x<block_w; x++){ | |
523 buf[x + y*linesize]= buf[end_x - 1 + y*linesize]; | |
524 } | |
525 } | |
526 } | |
527 | |
1064 | 528 static void get_pixels_c(DCTELEM *restrict block, const uint8_t *pixels, int line_size) |
0 | 529 { |
530 int i; | |
531 | |
532 /* read the pixels */ | |
533 for(i=0;i<8;i++) { | |
516 | 534 block[0] = pixels[0]; |
535 block[1] = pixels[1]; | |
536 block[2] = pixels[2]; | |
537 block[3] = pixels[3]; | |
538 block[4] = pixels[4]; | |
539 block[5] = pixels[5]; | |
540 block[6] = pixels[6]; | |
541 block[7] = pixels[7]; | |
542 pixels += line_size; | |
543 block += 8; | |
0 | 544 } |
545 } | |
546 | |
1064 | 547 static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1, |
2979 | 548 const uint8_t *s2, int stride){ |
324 | 549 int i; |
550 | |
551 /* read the pixels */ | |
552 for(i=0;i<8;i++) { | |
516 | 553 block[0] = s1[0] - s2[0]; |
554 block[1] = s1[1] - s2[1]; | |
555 block[2] = s1[2] - s2[2]; | |
556 block[3] = s1[3] - s2[3]; | |
557 block[4] = s1[4] - s2[4]; | |
558 block[5] = s1[5] - s2[5]; | |
559 block[6] = s1[6] - s2[6]; | |
560 block[7] = s1[7] - s2[7]; | |
324 | 561 s1 += stride; |
562 s2 += stride; | |
516 | 563 block += 8; |
324 | 564 } |
565 } | |
566 | |
567 | |
1064 | 568 static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, |
2979 | 569 int line_size) |
0 | 570 { |
571 int i; | |
4176 | 572 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
2967 | 573 |
0 | 574 /* read the pixels */ |
575 for(i=0;i<8;i++) { | |
516 | 576 pixels[0] = cm[block[0]]; |
577 pixels[1] = cm[block[1]]; | |
578 pixels[2] = cm[block[2]]; | |
579 pixels[3] = cm[block[3]]; | |
580 pixels[4] = cm[block[4]]; | |
581 pixels[5] = cm[block[5]]; | |
582 pixels[6] = cm[block[6]]; | |
583 pixels[7] = cm[block[7]]; | |
584 | |
585 pixels += line_size; | |
586 block += 8; | |
0 | 587 } |
588 } | |
589 | |
2256 | 590 static void put_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels, |
2979 | 591 int line_size) |
2256 | 592 { |
593 int i; | |
4176 | 594 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
2967 | 595 |
2256 | 596 /* read the pixels */ |
597 for(i=0;i<4;i++) { | |
598 pixels[0] = cm[block[0]]; | |
599 pixels[1] = cm[block[1]]; | |
600 pixels[2] = cm[block[2]]; | |
601 pixels[3] = cm[block[3]]; | |
602 | |
603 pixels += line_size; | |
604 block += 8; | |
605 } | |
606 } | |
607 | |
2257 | 608 static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels, |
2979 | 609 int line_size) |
2257 | 610 { |
611 int i; | |
4176 | 612 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
2967 | 613 |
2257 | 614 /* read the pixels */ |
615 for(i=0;i<2;i++) { | |
616 pixels[0] = cm[block[0]]; | |
617 pixels[1] = cm[block[1]]; | |
618 | |
619 pixels += line_size; | |
620 block += 8; | |
621 } | |
622 } | |
623 | |
2967 | 624 static void put_signed_pixels_clamped_c(const DCTELEM *block, |
1984
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
625 uint8_t *restrict pixels, |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
626 int line_size) |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
627 { |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
628 int i, j; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
629 |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
630 for (i = 0; i < 8; i++) { |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
631 for (j = 0; j < 8; j++) { |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
632 if (*block < -128) |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
633 *pixels = 0; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
634 else if (*block > 127) |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
635 *pixels = 255; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
636 else |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
637 *pixels = (uint8_t)(*block + 128); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
638 block++; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
639 pixels++; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
640 } |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
641 pixels += (line_size - 8); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
642 } |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
643 } |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
644 |
11231 | 645 static void put_pixels_nonclamped_c(const DCTELEM *block, uint8_t *restrict pixels, |
646 int line_size) | |
647 { | |
648 int i; | |
649 | |
650 /* read the pixels */ | |
651 for(i=0;i<8;i++) { | |
652 pixels[0] = block[0]; | |
653 pixels[1] = block[1]; | |
654 pixels[2] = block[2]; | |
655 pixels[3] = block[3]; | |
656 pixels[4] = block[4]; | |
657 pixels[5] = block[5]; | |
658 pixels[6] = block[6]; | |
659 pixels[7] = block[7]; | |
660 | |
661 pixels += line_size; | |
662 block += 8; | |
663 } | |
664 } | |
665 | |
1064 | 666 static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, |
516 | 667 int line_size) |
0 | 668 { |
669 int i; | |
4176 | 670 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
2967 | 671 |
0 | 672 /* read the pixels */ |
673 for(i=0;i<8;i++) { | |
516 | 674 pixels[0] = cm[pixels[0] + block[0]]; |
675 pixels[1] = cm[pixels[1] + block[1]]; | |
676 pixels[2] = cm[pixels[2] + block[2]]; | |
677 pixels[3] = cm[pixels[3] + block[3]]; | |
678 pixels[4] = cm[pixels[4] + block[4]]; | |
679 pixels[5] = cm[pixels[5] + block[5]]; | |
680 pixels[6] = cm[pixels[6] + block[6]]; | |
681 pixels[7] = cm[pixels[7] + block[7]]; | |
682 pixels += line_size; | |
683 block += 8; | |
0 | 684 } |
685 } | |
2256 | 686 |
687 static void add_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels, | |
688 int line_size) | |
689 { | |
690 int i; | |
4176 | 691 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
2967 | 692 |
2256 | 693 /* read the pixels */ |
694 for(i=0;i<4;i++) { | |
695 pixels[0] = cm[pixels[0] + block[0]]; | |
696 pixels[1] = cm[pixels[1] + block[1]]; | |
697 pixels[2] = cm[pixels[2] + block[2]]; | |
698 pixels[3] = cm[pixels[3] + block[3]]; | |
699 pixels += line_size; | |
700 block += 8; | |
701 } | |
702 } | |
2257 | 703 |
704 static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels, | |
705 int line_size) | |
706 { | |
707 int i; | |
4176 | 708 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
2967 | 709 |
2257 | 710 /* read the pixels */ |
711 for(i=0;i<2;i++) { | |
712 pixels[0] = cm[pixels[0] + block[0]]; | |
713 pixels[1] = cm[pixels[1] + block[1]]; | |
714 pixels += line_size; | |
715 block += 8; | |
716 } | |
717 } | |
2763 | 718 |
719 static void add_pixels8_c(uint8_t *restrict pixels, DCTELEM *block, int line_size) | |
720 { | |
721 int i; | |
722 for(i=0;i<8;i++) { | |
723 pixels[0] += block[0]; | |
724 pixels[1] += block[1]; | |
725 pixels[2] += block[2]; | |
726 pixels[3] += block[3]; | |
727 pixels[4] += block[4]; | |
728 pixels[5] += block[5]; | |
729 pixels[6] += block[6]; | |
730 pixels[7] += block[7]; | |
731 pixels += line_size; | |
732 block += 8; | |
733 } | |
734 } | |
735 | |
736 static void add_pixels4_c(uint8_t *restrict pixels, DCTELEM *block, int line_size) | |
737 { | |
738 int i; | |
739 for(i=0;i<4;i++) { | |
740 pixels[0] += block[0]; | |
741 pixels[1] += block[1]; | |
742 pixels[2] += block[2]; | |
743 pixels[3] += block[3]; | |
744 pixels += line_size; | |
745 block += 4; | |
746 } | |
747 } | |
748 | |
4988
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
749 static int sum_abs_dctelem_c(DCTELEM *block) |
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
750 { |
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
751 int sum=0, i; |
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
752 for(i=0; i<64; i++) |
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
753 sum+= FFABS(block[i]); |
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
754 return sum; |
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
755 } |
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
756 |
11231 | 757 static void fill_block16_c(uint8_t *block, uint8_t value, int line_size, int h) |
758 { | |
759 int i; | |
760 | |
761 for (i = 0; i < h; i++) { | |
762 memset(block, value, 16); | |
763 block += line_size; | |
764 } | |
765 } | |
766 | |
767 static void fill_block8_c(uint8_t *block, uint8_t value, int line_size, int h) | |
768 { | |
769 int i; | |
770 | |
771 for (i = 0; i < h; i++) { | |
772 memset(block, value, 8); | |
773 block += line_size; | |
774 } | |
775 } | |
776 | |
777 static void scale_block_c(const uint8_t src[64]/*align 8*/, uint8_t *dst/*align 8*/, int linesize) | |
778 { | |
779 int i, j; | |
780 uint16_t *dst1 = dst; | |
781 uint16_t *dst2 = dst + linesize; | |
782 | |
783 for (j = 0; j < 8; j++) { | |
784 for (i = 0; i < 8; i++) { | |
785 dst1[i] = dst2[i] = src[i] * 0x0101; | |
786 } | |
787 src += 8; | |
788 dst1 += linesize; | |
789 dst2 += linesize; | |
790 } | |
791 } | |
792 | |
385 | 793 #if 0 |
794 | |
795 #define PIXOP2(OPNAME, OP) \ | |
651 | 796 static void OPNAME ## _pixels(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 797 {\ |
798 int i;\ | |
799 for(i=0; i<h; i++){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
800 OP(*((uint64_t*)block), AV_RN64(pixels));\ |
385 | 801 pixels+=line_size;\ |
802 block +=line_size;\ | |
803 }\ | |
804 }\ | |
805 \ | |
859 | 806 static void OPNAME ## _no_rnd_pixels_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 807 {\ |
808 int i;\ | |
809 for(i=0; i<h; i++){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
810 const uint64_t a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
811 const uint64_t b= AV_RN64(pixels+1);\ |
385 | 812 OP(*((uint64_t*)block), (a&b) + (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\ |
813 pixels+=line_size;\ | |
814 block +=line_size;\ | |
815 }\ | |
816 }\ | |
817 \ | |
859 | 818 static void OPNAME ## _pixels_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 819 {\ |
820 int i;\ | |
821 for(i=0; i<h; i++){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
822 const uint64_t a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
823 const uint64_t b= AV_RN64(pixels+1);\ |
385 | 824 OP(*((uint64_t*)block), (a|b) - (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\ |
825 pixels+=line_size;\ | |
826 block +=line_size;\ | |
827 }\ | |
828 }\ | |
829 \ | |
859 | 830 static void OPNAME ## _no_rnd_pixels_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 831 {\ |
832 int i;\ | |
833 for(i=0; i<h; i++){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
834 const uint64_t a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
835 const uint64_t b= AV_RN64(pixels+line_size);\ |
385 | 836 OP(*((uint64_t*)block), (a&b) + (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\ |
837 pixels+=line_size;\ | |
838 block +=line_size;\ | |
839 }\ | |
840 }\ | |
841 \ | |
859 | 842 static void OPNAME ## _pixels_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 843 {\ |
844 int i;\ | |
845 for(i=0; i<h; i++){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
846 const uint64_t a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
847 const uint64_t b= AV_RN64(pixels+line_size);\ |
385 | 848 OP(*((uint64_t*)block), (a|b) - (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\ |
849 pixels+=line_size;\ | |
850 block +=line_size;\ | |
851 }\ | |
852 }\ | |
853 \ | |
859 | 854 static void OPNAME ## _pixels_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 855 {\ |
856 int i;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
857 const uint64_t a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
858 const uint64_t b= AV_RN64(pixels+1);\ |
385 | 859 uint64_t l0= (a&0x0303030303030303ULL)\ |
860 + (b&0x0303030303030303ULL)\ | |
861 + 0x0202020202020202ULL;\ | |
862 uint64_t h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\ | |
863 + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\ | |
864 uint64_t l1,h1;\ | |
865 \ | |
866 pixels+=line_size;\ | |
867 for(i=0; i<h; i+=2){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
868 uint64_t a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
869 uint64_t b= AV_RN64(pixels+1);\ |
385 | 870 l1= (a&0x0303030303030303ULL)\ |
871 + (b&0x0303030303030303ULL);\ | |
872 h1= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\ | |
873 + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\ | |
874 OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\ | |
875 pixels+=line_size;\ | |
876 block +=line_size;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
877 a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
878 b= AV_RN64(pixels+1);\ |
385 | 879 l0= (a&0x0303030303030303ULL)\ |
880 + (b&0x0303030303030303ULL)\ | |
881 + 0x0202020202020202ULL;\ | |
882 h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\ | |
883 + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\ | |
884 OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\ | |
885 pixels+=line_size;\ | |
886 block +=line_size;\ | |
887 }\ | |
888 }\ | |
889 \ | |
859 | 890 static void OPNAME ## _no_rnd_pixels_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 891 {\ |
892 int i;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
893 const uint64_t a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
894 const uint64_t b= AV_RN64(pixels+1);\ |
385 | 895 uint64_t l0= (a&0x0303030303030303ULL)\ |
896 + (b&0x0303030303030303ULL)\ | |
897 + 0x0101010101010101ULL;\ | |
898 uint64_t h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\ | |
899 + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\ | |
900 uint64_t l1,h1;\ | |
901 \ | |
902 pixels+=line_size;\ | |
903 for(i=0; i<h; i+=2){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
904 uint64_t a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
905 uint64_t b= AV_RN64(pixels+1);\ |
385 | 906 l1= (a&0x0303030303030303ULL)\ |
907 + (b&0x0303030303030303ULL);\ | |
908 h1= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\ | |
909 + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\ | |
910 OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\ | |
911 pixels+=line_size;\ | |
912 block +=line_size;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
913 a= AV_RN64(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
914 b= AV_RN64(pixels+1);\ |
385 | 915 l0= (a&0x0303030303030303ULL)\ |
916 + (b&0x0303030303030303ULL)\ | |
917 + 0x0101010101010101ULL;\ | |
918 h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\ | |
919 + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\ | |
920 OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\ | |
921 pixels+=line_size;\ | |
922 block +=line_size;\ | |
923 }\ | |
924 }\ | |
925 \ | |
859 | 926 CALL_2X_PIXELS(OPNAME ## _pixels16_c , OPNAME ## _pixels_c , 8)\ |
927 CALL_2X_PIXELS(OPNAME ## _pixels16_x2_c , OPNAME ## _pixels_x2_c , 8)\ | |
928 CALL_2X_PIXELS(OPNAME ## _pixels16_y2_c , OPNAME ## _pixels_y2_c , 8)\ | |
929 CALL_2X_PIXELS(OPNAME ## _pixels16_xy2_c, OPNAME ## _pixels_xy2_c, 8)\ | |
930 CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_x2_c , OPNAME ## _no_rnd_pixels_x2_c , 8)\ | |
931 CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_y2_c , OPNAME ## _no_rnd_pixels_y2_c , 8)\ | |
932 CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_xy2_c, OPNAME ## _no_rnd_pixels_xy2_c, 8) | |
385 | 933 |
934 #define op_avg(a, b) a = ( ((a)|(b)) - ((((a)^(b))&0xFEFEFEFEFEFEFEFEULL)>>1) ) | |
935 #else // 64 bit variant | |
936 | |
937 #define PIXOP2(OPNAME, OP) \ | |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
938 static void OPNAME ## _pixels2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
939 int i;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
940 for(i=0; i<h; i++){\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
941 OP(*((uint16_t*)(block )), AV_RN16(pixels ));\ |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
942 pixels+=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
943 block +=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
944 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
945 }\ |
1168 | 946 static void OPNAME ## _pixels4_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
947 int i;\ | |
948 for(i=0; i<h; i++){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
949 OP(*((uint32_t*)(block )), AV_RN32(pixels ));\ |
1168 | 950 pixels+=line_size;\ |
951 block +=line_size;\ | |
952 }\ | |
953 }\ | |
859 | 954 static void OPNAME ## _pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
385 | 955 int i;\ |
956 for(i=0; i<h; i++){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
957 OP(*((uint32_t*)(block )), AV_RN32(pixels ));\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
958 OP(*((uint32_t*)(block+4)), AV_RN32(pixels+4));\ |
385 | 959 pixels+=line_size;\ |
960 block +=line_size;\ | |
961 }\ | |
962 }\ | |
859 | 963 static inline void OPNAME ## _no_rnd_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
964 OPNAME ## _pixels8_c(block, pixels, line_size, h);\ | |
651 | 965 }\ |
385 | 966 \ |
651 | 967 static inline void OPNAME ## _no_rnd_pixels8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \ |
968 int src_stride1, int src_stride2, int h){\ | |
385 | 969 int i;\ |
970 for(i=0; i<h; i++){\ | |
651 | 971 uint32_t a,b;\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
972 a= AV_RN32(&src1[i*src_stride1 ]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
973 b= AV_RN32(&src2[i*src_stride2 ]);\ |
1264 | 974 OP(*((uint32_t*)&dst[i*dst_stride ]), no_rnd_avg32(a, b));\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
975 a= AV_RN32(&src1[i*src_stride1+4]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
976 b= AV_RN32(&src2[i*src_stride2+4]);\ |
1264 | 977 OP(*((uint32_t*)&dst[i*dst_stride+4]), no_rnd_avg32(a, b));\ |
385 | 978 }\ |
979 }\ | |
980 \ | |
651 | 981 static inline void OPNAME ## _pixels8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \ |
982 int src_stride1, int src_stride2, int h){\ | |
385 | 983 int i;\ |
984 for(i=0; i<h; i++){\ | |
651 | 985 uint32_t a,b;\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
986 a= AV_RN32(&src1[i*src_stride1 ]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
987 b= AV_RN32(&src2[i*src_stride2 ]);\ |
1264 | 988 OP(*((uint32_t*)&dst[i*dst_stride ]), rnd_avg32(a, b));\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
989 a= AV_RN32(&src1[i*src_stride1+4]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
990 b= AV_RN32(&src2[i*src_stride2+4]);\ |
1264 | 991 OP(*((uint32_t*)&dst[i*dst_stride+4]), rnd_avg32(a, b));\ |
385 | 992 }\ |
993 }\ | |
994 \ | |
1168 | 995 static inline void OPNAME ## _pixels4_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \ |
996 int src_stride1, int src_stride2, int h){\ | |
997 int i;\ | |
998 for(i=0; i<h; i++){\ | |
999 uint32_t a,b;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1000 a= AV_RN32(&src1[i*src_stride1 ]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1001 b= AV_RN32(&src2[i*src_stride2 ]);\ |
1264 | 1002 OP(*((uint32_t*)&dst[i*dst_stride ]), rnd_avg32(a, b));\ |
1168 | 1003 }\ |
1004 }\ | |
1005 \ | |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1006 static inline void OPNAME ## _pixels2_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1007 int src_stride1, int src_stride2, int h){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1008 int i;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1009 for(i=0; i<h; i++){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1010 uint32_t a,b;\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1011 a= AV_RN16(&src1[i*src_stride1 ]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1012 b= AV_RN16(&src2[i*src_stride2 ]);\ |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1013 OP(*((uint16_t*)&dst[i*dst_stride ]), rnd_avg32(a, b));\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1014 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1015 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1016 \ |
651 | 1017 static inline void OPNAME ## _pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \ |
1018 int src_stride1, int src_stride2, int h){\ | |
1019 OPNAME ## _pixels8_l2(dst , src1 , src2 , dst_stride, src_stride1, src_stride2, h);\ | |
1020 OPNAME ## _pixels8_l2(dst+8, src1+8, src2+8, dst_stride, src_stride1, src_stride2, h);\ | |
1021 }\ | |
1022 \ | |
1023 static inline void OPNAME ## _no_rnd_pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \ | |
1024 int src_stride1, int src_stride2, int h){\ | |
1025 OPNAME ## _no_rnd_pixels8_l2(dst , src1 , src2 , dst_stride, src_stride1, src_stride2, h);\ | |
1026 OPNAME ## _no_rnd_pixels8_l2(dst+8, src1+8, src2+8, dst_stride, src_stride1, src_stride2, h);\ | |
1027 }\ | |
1028 \ | |
859 | 1029 static inline void OPNAME ## _no_rnd_pixels8_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
651 | 1030 OPNAME ## _no_rnd_pixels8_l2(block, pixels, pixels+1, line_size, line_size, line_size, h);\ |
1031 }\ | |
1032 \ | |
859 | 1033 static inline void OPNAME ## _pixels8_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
651 | 1034 OPNAME ## _pixels8_l2(block, pixels, pixels+1, line_size, line_size, line_size, h);\ |
1035 }\ | |
1036 \ | |
859 | 1037 static inline void OPNAME ## _no_rnd_pixels8_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
651 | 1038 OPNAME ## _no_rnd_pixels8_l2(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\ |
1039 }\ | |
1040 \ | |
859 | 1041 static inline void OPNAME ## _pixels8_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
651 | 1042 OPNAME ## _pixels8_l2(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\ |
385 | 1043 }\ |
1044 \ | |
651 | 1045 static inline void OPNAME ## _pixels8_l4(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,\ |
1046 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\ | |
1047 int i;\ | |
1048 for(i=0; i<h; i++){\ | |
1049 uint32_t a, b, c, d, l0, l1, h0, h1;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1050 a= AV_RN32(&src1[i*src_stride1]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1051 b= AV_RN32(&src2[i*src_stride2]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1052 c= AV_RN32(&src3[i*src_stride3]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1053 d= AV_RN32(&src4[i*src_stride4]);\ |
651 | 1054 l0= (a&0x03030303UL)\ |
1055 + (b&0x03030303UL)\ | |
1056 + 0x02020202UL;\ | |
1057 h0= ((a&0xFCFCFCFCUL)>>2)\ | |
1058 + ((b&0xFCFCFCFCUL)>>2);\ | |
1059 l1= (c&0x03030303UL)\ | |
1060 + (d&0x03030303UL);\ | |
1061 h1= ((c&0xFCFCFCFCUL)>>2)\ | |
1062 + ((d&0xFCFCFCFCUL)>>2);\ | |
1063 OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1064 a= AV_RN32(&src1[i*src_stride1+4]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1065 b= AV_RN32(&src2[i*src_stride2+4]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1066 c= AV_RN32(&src3[i*src_stride3+4]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1067 d= AV_RN32(&src4[i*src_stride4+4]);\ |
651 | 1068 l0= (a&0x03030303UL)\ |
1069 + (b&0x03030303UL)\ | |
1070 + 0x02020202UL;\ | |
1071 h0= ((a&0xFCFCFCFCUL)>>2)\ | |
1072 + ((b&0xFCFCFCFCUL)>>2);\ | |
1073 l1= (c&0x03030303UL)\ | |
1074 + (d&0x03030303UL);\ | |
1075 h1= ((c&0xFCFCFCFCUL)>>2)\ | |
1076 + ((d&0xFCFCFCFCUL)>>2);\ | |
1077 OP(*((uint32_t*)&dst[i*dst_stride+4]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ | |
1078 }\ | |
1079 }\ | |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1080 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1081 static inline void OPNAME ## _pixels4_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1082 OPNAME ## _pixels4_l2(block, pixels, pixels+1, line_size, line_size, line_size, h);\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1083 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1084 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1085 static inline void OPNAME ## _pixels4_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1086 OPNAME ## _pixels4_l2(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1087 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1088 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1089 static inline void OPNAME ## _pixels2_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1090 OPNAME ## _pixels2_l2(block, pixels, pixels+1, line_size, line_size, line_size, h);\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1091 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1092 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1093 static inline void OPNAME ## _pixels2_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1094 OPNAME ## _pixels2_l2(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1095 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1096 \ |
651 | 1097 static inline void OPNAME ## _no_rnd_pixels8_l4(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,\ |
1098 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\ | |
385 | 1099 int i;\ |
1100 for(i=0; i<h; i++){\ | |
651 | 1101 uint32_t a, b, c, d, l0, l1, h0, h1;\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1102 a= AV_RN32(&src1[i*src_stride1]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1103 b= AV_RN32(&src2[i*src_stride2]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1104 c= AV_RN32(&src3[i*src_stride3]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1105 d= AV_RN32(&src4[i*src_stride4]);\ |
651 | 1106 l0= (a&0x03030303UL)\ |
1107 + (b&0x03030303UL)\ | |
1108 + 0x01010101UL;\ | |
1109 h0= ((a&0xFCFCFCFCUL)>>2)\ | |
1110 + ((b&0xFCFCFCFCUL)>>2);\ | |
1111 l1= (c&0x03030303UL)\ | |
1112 + (d&0x03030303UL);\ | |
1113 h1= ((c&0xFCFCFCFCUL)>>2)\ | |
1114 + ((d&0xFCFCFCFCUL)>>2);\ | |
1115 OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1116 a= AV_RN32(&src1[i*src_stride1+4]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1117 b= AV_RN32(&src2[i*src_stride2+4]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1118 c= AV_RN32(&src3[i*src_stride3+4]);\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1119 d= AV_RN32(&src4[i*src_stride4+4]);\ |
651 | 1120 l0= (a&0x03030303UL)\ |
1121 + (b&0x03030303UL)\ | |
1122 + 0x01010101UL;\ | |
1123 h0= ((a&0xFCFCFCFCUL)>>2)\ | |
1124 + ((b&0xFCFCFCFCUL)>>2);\ | |
1125 l1= (c&0x03030303UL)\ | |
1126 + (d&0x03030303UL);\ | |
1127 h1= ((c&0xFCFCFCFCUL)>>2)\ | |
1128 + ((d&0xFCFCFCFCUL)>>2);\ | |
1129 OP(*((uint32_t*)&dst[i*dst_stride+4]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ | |
385 | 1130 }\ |
1131 }\ | |
651 | 1132 static inline void OPNAME ## _pixels16_l4(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,\ |
1133 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\ | |
1134 OPNAME ## _pixels8_l4(dst , src1 , src2 , src3 , src4 , dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\ | |
1135 OPNAME ## _pixels8_l4(dst+8, src1+8, src2+8, src3+8, src4+8, dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\ | |
1136 }\ | |
1137 static inline void OPNAME ## _no_rnd_pixels16_l4(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,\ | |
1138 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\ | |
1139 OPNAME ## _no_rnd_pixels8_l4(dst , src1 , src2 , src3 , src4 , dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\ | |
1140 OPNAME ## _no_rnd_pixels8_l4(dst+8, src1+8, src2+8, src3+8, src4+8, dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\ | |
1141 }\ | |
385 | 1142 \ |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1143 static inline void OPNAME ## _pixels2_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1144 {\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1145 int i, a0, b0, a1, b1;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1146 a0= pixels[0];\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1147 b0= pixels[1] + 2;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1148 a0 += b0;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1149 b0 += pixels[2];\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1150 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1151 pixels+=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1152 for(i=0; i<h; i+=2){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1153 a1= pixels[0];\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1154 b1= pixels[1];\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1155 a1 += b1;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1156 b1 += pixels[2];\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1157 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1158 block[0]= (a1+a0)>>2; /* FIXME non put */\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1159 block[1]= (b1+b0)>>2;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1160 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1161 pixels+=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1162 block +=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1163 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1164 a0= pixels[0];\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1165 b0= pixels[1] + 2;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1166 a0 += b0;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1167 b0 += pixels[2];\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1168 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1169 block[0]= (a1+a0)>>2;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1170 block[1]= (b1+b0)>>2;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1171 pixels+=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1172 block +=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1173 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1174 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1175 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1176 static inline void OPNAME ## _pixels4_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1177 {\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1178 int i;\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1179 const uint32_t a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1180 const uint32_t b= AV_RN32(pixels+1);\ |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1181 uint32_t l0= (a&0x03030303UL)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1182 + (b&0x03030303UL)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1183 + 0x02020202UL;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1184 uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1185 + ((b&0xFCFCFCFCUL)>>2);\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1186 uint32_t l1,h1;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1187 \ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1188 pixels+=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1189 for(i=0; i<h; i+=2){\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1190 uint32_t a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1191 uint32_t b= AV_RN32(pixels+1);\ |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1192 l1= (a&0x03030303UL)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1193 + (b&0x03030303UL);\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1194 h1= ((a&0xFCFCFCFCUL)>>2)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1195 + ((b&0xFCFCFCFCUL)>>2);\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1196 OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1197 pixels+=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1198 block +=line_size;\ |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1199 a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1200 b= AV_RN32(pixels+1);\ |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1201 l0= (a&0x03030303UL)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1202 + (b&0x03030303UL)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1203 + 0x02020202UL;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1204 h0= ((a&0xFCFCFCFCUL)>>2)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1205 + ((b&0xFCFCFCFCUL)>>2);\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1206 OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1207 pixels+=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1208 block +=line_size;\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1209 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1210 }\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1211 \ |
859 | 1212 static inline void OPNAME ## _pixels8_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 1213 {\ |
1214 int j;\ | |
1215 for(j=0; j<2; j++){\ | |
1216 int i;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1217 const uint32_t a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1218 const uint32_t b= AV_RN32(pixels+1);\ |
385 | 1219 uint32_t l0= (a&0x03030303UL)\ |
1220 + (b&0x03030303UL)\ | |
1221 + 0x02020202UL;\ | |
1222 uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\ | |
1223 + ((b&0xFCFCFCFCUL)>>2);\ | |
1224 uint32_t l1,h1;\ | |
1225 \ | |
1226 pixels+=line_size;\ | |
1227 for(i=0; i<h; i+=2){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1228 uint32_t a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1229 uint32_t b= AV_RN32(pixels+1);\ |
385 | 1230 l1= (a&0x03030303UL)\ |
1231 + (b&0x03030303UL);\ | |
1232 h1= ((a&0xFCFCFCFCUL)>>2)\ | |
1233 + ((b&0xFCFCFCFCUL)>>2);\ | |
1234 OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ | |
1235 pixels+=line_size;\ | |
1236 block +=line_size;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1237 a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1238 b= AV_RN32(pixels+1);\ |
385 | 1239 l0= (a&0x03030303UL)\ |
1240 + (b&0x03030303UL)\ | |
1241 + 0x02020202UL;\ | |
1242 h0= ((a&0xFCFCFCFCUL)>>2)\ | |
1243 + ((b&0xFCFCFCFCUL)>>2);\ | |
1244 OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ | |
1245 pixels+=line_size;\ | |
1246 block +=line_size;\ | |
1247 }\ | |
1248 pixels+=4-line_size*(h+1);\ | |
1249 block +=4-line_size*h;\ | |
1250 }\ | |
1251 }\ | |
1252 \ | |
859 | 1253 static inline void OPNAME ## _no_rnd_pixels8_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\ |
385 | 1254 {\ |
1255 int j;\ | |
1256 for(j=0; j<2; j++){\ | |
1257 int i;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1258 const uint32_t a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1259 const uint32_t b= AV_RN32(pixels+1);\ |
385 | 1260 uint32_t l0= (a&0x03030303UL)\ |
1261 + (b&0x03030303UL)\ | |
1262 + 0x01010101UL;\ | |
1263 uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\ | |
1264 + ((b&0xFCFCFCFCUL)>>2);\ | |
1265 uint32_t l1,h1;\ | |
1266 \ | |
1267 pixels+=line_size;\ | |
1268 for(i=0; i<h; i+=2){\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1269 uint32_t a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1270 uint32_t b= AV_RN32(pixels+1);\ |
385 | 1271 l1= (a&0x03030303UL)\ |
1272 + (b&0x03030303UL);\ | |
1273 h1= ((a&0xFCFCFCFCUL)>>2)\ | |
1274 + ((b&0xFCFCFCFCUL)>>2);\ | |
1275 OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ | |
1276 pixels+=line_size;\ | |
1277 block +=line_size;\ | |
5520
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1278 a= AV_RN32(pixels );\ |
c16a59ef6a86
* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
romansh
parents:
5411
diff
changeset
|
1279 b= AV_RN32(pixels+1);\ |
385 | 1280 l0= (a&0x03030303UL)\ |
1281 + (b&0x03030303UL)\ | |
1282 + 0x01010101UL;\ | |
1283 h0= ((a&0xFCFCFCFCUL)>>2)\ | |
1284 + ((b&0xFCFCFCFCUL)>>2);\ | |
1285 OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ | |
1286 pixels+=line_size;\ | |
1287 block +=line_size;\ | |
1288 }\ | |
1289 pixels+=4-line_size*(h+1);\ | |
1290 block +=4-line_size*h;\ | |
1291 }\ | |
1292 }\ | |
1293 \ | |
859 | 1294 CALL_2X_PIXELS(OPNAME ## _pixels16_c , OPNAME ## _pixels8_c , 8)\ |
1295 CALL_2X_PIXELS(OPNAME ## _pixels16_x2_c , OPNAME ## _pixels8_x2_c , 8)\ | |
1296 CALL_2X_PIXELS(OPNAME ## _pixels16_y2_c , OPNAME ## _pixels8_y2_c , 8)\ | |
1297 CALL_2X_PIXELS(OPNAME ## _pixels16_xy2_c, OPNAME ## _pixels8_xy2_c, 8)\ | |
1298 CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_c , OPNAME ## _pixels8_c , 8)\ | |
1299 CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_x2_c , OPNAME ## _no_rnd_pixels8_x2_c , 8)\ | |
1300 CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_y2_c , OPNAME ## _no_rnd_pixels8_y2_c , 8)\ | |
1301 CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_xy2_c, OPNAME ## _no_rnd_pixels8_xy2_c, 8)\ | |
651 | 1302 |
1264 | 1303 #define op_avg(a, b) a = rnd_avg32(a, b) |
385 | 1304 #endif |
1305 #define op_put(a, b) a = b | |
1306 | |
1307 PIXOP2(avg, op_avg) | |
1308 PIXOP2(put, op_put) | |
1309 #undef op_avg | |
1310 #undef op_put | |
1311 | |
0 | 1312 #define avg2(a,b) ((a+b+1)>>1) |
1313 #define avg4(a,b,c,d) ((a+b+c+d+2)>>2) | |
1314 | |
1864 | 1315 static void put_no_rnd_pixels16_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){ |
1316 put_no_rnd_pixels16_l2(dst, a, b, stride, stride, stride, h); | |
1317 } | |
1318 | |
1319 static void put_no_rnd_pixels8_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){ | |
1320 put_no_rnd_pixels8_l2(dst, a, b, stride, stride, stride, h); | |
1321 } | |
753 | 1322 |
1064 | 1323 static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder) |
255 | 1324 { |
1325 const int A=(16-x16)*(16-y16); | |
1326 const int B=( x16)*(16-y16); | |
1327 const int C=(16-x16)*( y16); | |
1328 const int D=( x16)*( y16); | |
1329 int i; | |
1330 | |
1331 for(i=0; i<h; i++) | |
1332 { | |
651 | 1333 dst[0]= (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + rounder)>>8; |
1334 dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8; | |
1335 dst[2]= (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + rounder)>>8; | |
1336 dst[3]= (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + rounder)>>8; | |
1337 dst[4]= (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + rounder)>>8; | |
1338 dst[5]= (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + rounder)>>8; | |
1339 dst[6]= (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + rounder)>>8; | |
1340 dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8; | |
1341 dst+= stride; | |
1342 src+= stride; | |
255 | 1343 } |
1344 } | |
1345 | |
3248
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3245
diff
changeset
|
1346 void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, |
753 | 1347 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) |
1348 { | |
1349 int y, vx, vy; | |
1350 const int s= 1<<shift; | |
2967 | 1351 |
753 | 1352 width--; |
1353 height--; | |
1354 | |
1355 for(y=0; y<h; y++){ | |
1356 int x; | |
1357 | |
1358 vx= ox; | |
1359 vy= oy; | |
1360 for(x=0; x<8; x++){ //XXX FIXME optimize | |
1361 int src_x, src_y, frac_x, frac_y, index; | |
1362 | |
1363 src_x= vx>>16; | |
1364 src_y= vy>>16; | |
1365 frac_x= src_x&(s-1); | |
1366 frac_y= src_y&(s-1); | |
1367 src_x>>=shift; | |
1368 src_y>>=shift; | |
2967 | 1369 |
753 | 1370 if((unsigned)src_x < width){ |
1371 if((unsigned)src_y < height){ | |
1372 index= src_x + src_y*stride; | |
1373 dst[y*stride + x]= ( ( src[index ]*(s-frac_x) | |
1374 + src[index +1]* frac_x )*(s-frac_y) | |
1375 + ( src[index+stride ]*(s-frac_x) | |
1376 + src[index+stride+1]* frac_x )* frac_y | |
1377 + r)>>(shift*2); | |
1378 }else{ | |
4594 | 1379 index= src_x + av_clip(src_y, 0, height)*stride; |
2967 | 1380 dst[y*stride + x]= ( ( src[index ]*(s-frac_x) |
753 | 1381 + src[index +1]* frac_x )*s |
1382 + r)>>(shift*2); | |
1383 } | |
1384 }else{ | |
1385 if((unsigned)src_y < height){ | |
4594 | 1386 index= av_clip(src_x, 0, width) + src_y*stride; |
2967 | 1387 dst[y*stride + x]= ( ( src[index ]*(s-frac_y) |
753 | 1388 + src[index+stride ]* frac_y )*s |
1389 + r)>>(shift*2); | |
1390 }else{ | |
4594 | 1391 index= av_clip(src_x, 0, width) + av_clip(src_y, 0, height)*stride; |
753 | 1392 dst[y*stride + x]= src[index ]; |
1393 } | |
1394 } | |
2967 | 1395 |
753 | 1396 vx+= dxx; |
1397 vy+= dyx; | |
1398 } | |
1399 ox += dxy; | |
1400 oy += dyy; | |
1401 } | |
1402 } | |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1403 |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1404 static inline void put_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1405 switch(width){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1406 case 2: put_pixels2_c (dst, src, stride, height); break; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1407 case 4: put_pixels4_c (dst, src, stride, height); break; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1408 case 8: put_pixels8_c (dst, src, stride, height); break; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1409 case 16:put_pixels16_c(dst, src, stride, height); break; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1410 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1411 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1412 |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1413 static inline void put_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1414 int i,j; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1415 for (i=0; i < height; i++) { |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1416 for (j=0; j < width; j++) { |
2979 | 1417 dst[j] = (683*(2*src[j] + src[j+1] + 1)) >> 11; |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1418 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1419 src += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1420 dst += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1421 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1422 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1423 |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1424 static inline void put_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1425 int i,j; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1426 for (i=0; i < height; i++) { |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1427 for (j=0; j < width; j++) { |
2979 | 1428 dst[j] = (683*(src[j] + 2*src[j+1] + 1)) >> 11; |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1429 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1430 src += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1431 dst += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1432 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1433 } |
2967 | 1434 |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1435 static inline void put_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1436 int i,j; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1437 for (i=0; i < height; i++) { |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1438 for (j=0; j < width; j++) { |
2979 | 1439 dst[j] = (683*(2*src[j] + src[j+stride] + 1)) >> 11; |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1440 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1441 src += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1442 dst += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1443 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1444 } |
2967 | 1445 |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1446 static inline void put_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1447 int i,j; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1448 for (i=0; i < height; i++) { |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1449 for (j=0; j < width; j++) { |
2979 | 1450 dst[j] = (2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15; |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1451 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1452 src += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1453 dst += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1454 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1455 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1456 |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1457 static inline void put_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1458 int i,j; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1459 for (i=0; i < height; i++) { |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1460 for (j=0; j < width; j++) { |
2979 | 1461 dst[j] = (2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15; |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1462 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1463 src += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1464 dst += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1465 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1466 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1467 |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1468 static inline void put_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1469 int i,j; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1470 for (i=0; i < height; i++) { |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1471 for (j=0; j < width; j++) { |
2979 | 1472 dst[j] = (683*(src[j] + 2*src[j+stride] + 1)) >> 11; |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1473 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1474 src += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1475 dst += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1476 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1477 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1478 |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1479 static inline void put_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1480 int i,j; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1481 for (i=0; i < height; i++) { |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1482 for (j=0; j < width; j++) { |
2979 | 1483 dst[j] = (2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15; |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1484 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1485 src += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1486 dst += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1487 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1488 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1489 |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1490 static inline void put_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1491 int i,j; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1492 for (i=0; i < height; i++) { |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1493 for (j=0; j < width; j++) { |
2979 | 1494 dst[j] = (2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15; |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1495 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1496 src += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1497 dst += stride; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1498 } |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1499 } |
1319 | 1500 |
1501 static inline void avg_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1502 switch(width){ | |
1503 case 2: avg_pixels2_c (dst, src, stride, height); break; | |
1504 case 4: avg_pixels4_c (dst, src, stride, height); break; | |
1505 case 8: avg_pixels8_c (dst, src, stride, height); break; | |
1506 case 16:avg_pixels16_c(dst, src, stride, height); break; | |
1507 } | |
1508 } | |
1509 | |
1510 static inline void avg_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1511 int i,j; | |
1512 for (i=0; i < height; i++) { | |
1513 for (j=0; j < width; j++) { | |
2979 | 1514 dst[j] = (dst[j] + ((683*(2*src[j] + src[j+1] + 1)) >> 11) + 1) >> 1; |
1319 | 1515 } |
1516 src += stride; | |
1517 dst += stride; | |
1518 } | |
1519 } | |
1520 | |
1521 static inline void avg_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1522 int i,j; | |
1523 for (i=0; i < height; i++) { | |
1524 for (j=0; j < width; j++) { | |
2979 | 1525 dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+1] + 1)) >> 11) + 1) >> 1; |
1319 | 1526 } |
1527 src += stride; | |
1528 dst += stride; | |
1529 } | |
1530 } | |
2967 | 1531 |
1319 | 1532 static inline void avg_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
1533 int i,j; | |
1534 for (i=0; i < height; i++) { | |
1535 for (j=0; j < width; j++) { | |
2979 | 1536 dst[j] = (dst[j] + ((683*(2*src[j] + src[j+stride] + 1)) >> 11) + 1) >> 1; |
1319 | 1537 } |
1538 src += stride; | |
1539 dst += stride; | |
1540 } | |
1541 } | |
2967 | 1542 |
1319 | 1543 static inline void avg_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
1544 int i,j; | |
1545 for (i=0; i < height; i++) { | |
1546 for (j=0; j < width; j++) { | |
2979 | 1547 dst[j] = (dst[j] + ((2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15) + 1) >> 1; |
1319 | 1548 } |
1549 src += stride; | |
1550 dst += stride; | |
1551 } | |
1552 } | |
1553 | |
1554 static inline void avg_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1555 int i,j; | |
1556 for (i=0; i < height; i++) { | |
1557 for (j=0; j < width; j++) { | |
2979 | 1558 dst[j] = (dst[j] + ((2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1; |
1319 | 1559 } |
1560 src += stride; | |
1561 dst += stride; | |
1562 } | |
1563 } | |
1564 | |
1565 static inline void avg_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1566 int i,j; | |
1567 for (i=0; i < height; i++) { | |
1568 for (j=0; j < width; j++) { | |
2979 | 1569 dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+stride] + 1)) >> 11) + 1) >> 1; |
1319 | 1570 } |
1571 src += stride; | |
1572 dst += stride; | |
1573 } | |
1574 } | |
1575 | |
1576 static inline void avg_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1577 int i,j; | |
1578 for (i=0; i < height; i++) { | |
1579 for (j=0; j < width; j++) { | |
2979 | 1580 dst[j] = (dst[j] + ((2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1; |
1319 | 1581 } |
1582 src += stride; | |
1583 dst += stride; | |
1584 } | |
1585 } | |
1586 | |
1587 static inline void avg_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1588 int i,j; | |
1589 for (i=0; i < height; i++) { | |
1590 for (j=0; j < width; j++) { | |
2979 | 1591 dst[j] = (dst[j] + ((2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15) + 1) >> 1; |
1319 | 1592 } |
1593 src += stride; | |
1594 dst += stride; | |
1595 } | |
1596 } | |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1597 #if 0 |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1598 #define TPEL_WIDTH(width)\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1599 static void put_tpel_pixels ## width ## _mc00_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1600 void put_tpel_pixels_mc00_c(dst, src, stride, width, height);}\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1601 static void put_tpel_pixels ## width ## _mc10_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1602 void put_tpel_pixels_mc10_c(dst, src, stride, width, height);}\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1603 static void put_tpel_pixels ## width ## _mc20_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1604 void put_tpel_pixels_mc20_c(dst, src, stride, width, height);}\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1605 static void put_tpel_pixels ## width ## _mc01_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1606 void put_tpel_pixels_mc01_c(dst, src, stride, width, height);}\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1607 static void put_tpel_pixels ## width ## _mc11_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1608 void put_tpel_pixels_mc11_c(dst, src, stride, width, height);}\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1609 static void put_tpel_pixels ## width ## _mc21_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1610 void put_tpel_pixels_mc21_c(dst, src, stride, width, height);}\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1611 static void put_tpel_pixels ## width ## _mc02_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1612 void put_tpel_pixels_mc02_c(dst, src, stride, width, height);}\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1613 static void put_tpel_pixels ## width ## _mc12_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1614 void put_tpel_pixels_mc12_c(dst, src, stride, width, height);}\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1615 static void put_tpel_pixels ## width ## _mc22_c(uint8_t *dst, const uint8_t *src, int stride, int height){\ |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1616 void put_tpel_pixels_mc22_c(dst, src, stride, width, height);} |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1617 #endif |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
1618 |
1168 | 1619 #define H264_CHROMA_MC(OPNAME, OP)\ |
1620 static void OPNAME ## h264_chroma_mc2_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\ | |
1621 const int A=(8-x)*(8-y);\ | |
1622 const int B=( x)*(8-y);\ | |
1623 const int C=(8-x)*( y);\ | |
1624 const int D=( x)*( y);\ | |
1625 int i;\ | |
1626 \ | |
1627 assert(x<8 && y<8 && x>=0 && y>=0);\ | |
1628 \ | |
6052
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1629 if(D){\ |
6054 | 1630 for(i=0; i<h; i++){\ |
6053 | 1631 OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\ |
1632 OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\ | |
1633 dst+= stride;\ | |
1634 src+= stride;\ | |
1635 }\ | |
6052
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1636 }else{\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1637 const int E= B+C;\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1638 const int step= C ? stride : 1;\ |
6054 | 1639 for(i=0; i<h; i++){\ |
6052
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1640 OP(dst[0], (A*src[0] + E*src[step+0]));\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1641 OP(dst[1], (A*src[1] + E*src[step+1]));\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1642 dst+= stride;\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1643 src+= stride;\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1644 }\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1645 }\ |
1168 | 1646 }\ |
1647 \ | |
1648 static void OPNAME ## h264_chroma_mc4_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\ | |
1649 const int A=(8-x)*(8-y);\ | |
1650 const int B=( x)*(8-y);\ | |
1651 const int C=(8-x)*( y);\ | |
1652 const int D=( x)*( y);\ | |
1653 int i;\ | |
1654 \ | |
1655 assert(x<8 && y<8 && x>=0 && y>=0);\ | |
1656 \ | |
6052
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1657 if(D){\ |
6054 | 1658 for(i=0; i<h; i++){\ |
6053 | 1659 OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\ |
1660 OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\ | |
1661 OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\ | |
1662 OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));\ | |
1663 dst+= stride;\ | |
1664 src+= stride;\ | |
1665 }\ | |
6052
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1666 }else{\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1667 const int E= B+C;\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1668 const int step= C ? stride : 1;\ |
6054 | 1669 for(i=0; i<h; i++){\ |
6052
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1670 OP(dst[0], (A*src[0] + E*src[step+0]));\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1671 OP(dst[1], (A*src[1] + E*src[step+1]));\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1672 OP(dst[2], (A*src[2] + E*src[step+2]));\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1673 OP(dst[3], (A*src[3] + E*src[step+3]));\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1674 dst+= stride;\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1675 src+= stride;\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1676 }\ |
c90798ac28ee
~15% faster h264_chroma_mc2/4_c() these also prevent some possible out
michael
parents:
6051
diff
changeset
|
1677 }\ |
1168 | 1678 }\ |
1679 \ | |
1680 static void OPNAME ## h264_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\ | |
1681 const int A=(8-x)*(8-y);\ | |
1682 const int B=( x)*(8-y);\ | |
1683 const int C=(8-x)*( y);\ | |
1684 const int D=( x)*( y);\ | |
1685 int i;\ | |
1686 \ | |
1687 assert(x<8 && y<8 && x>=0 && y>=0);\ | |
1688 \ | |
6051
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1689 if(D){\ |
6054 | 1690 for(i=0; i<h; i++){\ |
6053 | 1691 OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\ |
1692 OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\ | |
1693 OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\ | |
1694 OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));\ | |
1695 OP(dst[4], (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5]));\ | |
1696 OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6]));\ | |
1697 OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7]));\ | |
1698 OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8]));\ | |
1699 dst+= stride;\ | |
1700 src+= stride;\ | |
1701 }\ | |
6051
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1702 }else{\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1703 const int E= B+C;\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1704 const int step= C ? stride : 1;\ |
6054 | 1705 for(i=0; i<h; i++){\ |
6051
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1706 OP(dst[0], (A*src[0] + E*src[step+0]));\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1707 OP(dst[1], (A*src[1] + E*src[step+1]));\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1708 OP(dst[2], (A*src[2] + E*src[step+2]));\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1709 OP(dst[3], (A*src[3] + E*src[step+3]));\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1710 OP(dst[4], (A*src[4] + E*src[step+4]));\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1711 OP(dst[5], (A*src[5] + E*src[step+5]));\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1712 OP(dst[6], (A*src[6] + E*src[step+6]));\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1713 OP(dst[7], (A*src[7] + E*src[step+7]));\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1714 dst+= stride;\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1715 src+= stride;\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1716 }\ |
1e3b5597505a
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
michael
parents:
6001
diff
changeset
|
1717 }\ |
1168 | 1718 } |
1719 | |
1720 #define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1) | |
1721 #define op_put(a, b) a = (((b) + 32)>>6) | |
1722 | |
1723 H264_CHROMA_MC(put_ , op_put) | |
1724 H264_CHROMA_MC(avg_ , op_avg) | |
1725 #undef op_avg | |
1726 #undef op_put | |
1727 | |
9439
ef3a7b711cc0
Rename put_no_rnd_h264_chroma* to reflect its usage in VC1 only
conrad
parents:
9437
diff
changeset
|
1728 static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ |
3663 | 1729 const int A=(8-x)*(8-y); |
1730 const int B=( x)*(8-y); | |
1731 const int C=(8-x)*( y); | |
1732 const int D=( x)*( y); | |
1733 int i; | |
1734 | |
1735 assert(x<8 && y<8 && x>=0 && y>=0); | |
1736 | |
1737 for(i=0; i<h; i++) | |
1738 { | |
1739 dst[0] = (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6; | |
1740 dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6; | |
1741 dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6; | |
1742 dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6; | |
1743 dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6; | |
1744 dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6; | |
1745 dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6; | |
1746 dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6; | |
1747 dst+= stride; | |
1748 src+= stride; | |
1749 } | |
1750 } | |
1751 | |
9440 | 1752 static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ |
1753 const int A=(8-x)*(8-y); | |
1754 const int B=( x)*(8-y); | |
1755 const int C=(8-x)*( y); | |
1756 const int D=( x)*( y); | |
1757 int i; | |
1758 | |
1759 assert(x<8 && y<8 && x>=0 && y>=0); | |
1760 | |
1761 for(i=0; i<h; i++) | |
1762 { | |
1763 dst[0] = avg2(dst[0], ((A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6)); | |
1764 dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6)); | |
1765 dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6)); | |
1766 dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6)); | |
1767 dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6)); | |
1768 dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6)); | |
1769 dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6)); | |
1770 dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6)); | |
1771 dst+= stride; | |
1772 src+= stride; | |
1773 } | |
1774 } | |
1775 | |
651 | 1776 #define QPEL_MC(r, OPNAME, RND, OP) \ |
1064 | 1777 static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ |
4176 | 1778 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
651 | 1779 int i;\ |
1780 for(i=0; i<h; i++)\ | |
1781 {\ | |
1782 OP(dst[0], (src[0]+src[1])*20 - (src[0]+src[2])*6 + (src[1]+src[3])*3 - (src[2]+src[4]));\ | |
1783 OP(dst[1], (src[1]+src[2])*20 - (src[0]+src[3])*6 + (src[0]+src[4])*3 - (src[1]+src[5]));\ | |
1784 OP(dst[2], (src[2]+src[3])*20 - (src[1]+src[4])*6 + (src[0]+src[5])*3 - (src[0]+src[6]));\ | |
1785 OP(dst[3], (src[3]+src[4])*20 - (src[2]+src[5])*6 + (src[1]+src[6])*3 - (src[0]+src[7]));\ | |
1786 OP(dst[4], (src[4]+src[5])*20 - (src[3]+src[6])*6 + (src[2]+src[7])*3 - (src[1]+src[8]));\ | |
1787 OP(dst[5], (src[5]+src[6])*20 - (src[4]+src[7])*6 + (src[3]+src[8])*3 - (src[2]+src[8]));\ | |
1788 OP(dst[6], (src[6]+src[7])*20 - (src[5]+src[8])*6 + (src[4]+src[8])*3 - (src[3]+src[7]));\ | |
1789 OP(dst[7], (src[7]+src[8])*20 - (src[6]+src[8])*6 + (src[5]+src[7])*3 - (src[4]+src[6]));\ | |
1790 dst+=dstStride;\ | |
1791 src+=srcStride;\ | |
1792 }\ | |
1793 }\ | |
1794 \ | |
1064 | 1795 static void OPNAME ## mpeg4_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ |
984 | 1796 const int w=8;\ |
4176 | 1797 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
651 | 1798 int i;\ |
1799 for(i=0; i<w; i++)\ | |
1800 {\ | |
1801 const int src0= src[0*srcStride];\ | |
1802 const int src1= src[1*srcStride];\ | |
1803 const int src2= src[2*srcStride];\ | |
1804 const int src3= src[3*srcStride];\ | |
1805 const int src4= src[4*srcStride];\ | |
1806 const int src5= src[5*srcStride];\ | |
1807 const int src6= src[6*srcStride];\ | |
1808 const int src7= src[7*srcStride];\ | |
1809 const int src8= src[8*srcStride];\ | |
1810 OP(dst[0*dstStride], (src0+src1)*20 - (src0+src2)*6 + (src1+src3)*3 - (src2+src4));\ | |
1811 OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*6 + (src0+src4)*3 - (src1+src5));\ | |
1812 OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*6 + (src0+src5)*3 - (src0+src6));\ | |
1813 OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*6 + (src1+src6)*3 - (src0+src7));\ | |
1814 OP(dst[4*dstStride], (src4+src5)*20 - (src3+src6)*6 + (src2+src7)*3 - (src1+src8));\ | |
1815 OP(dst[5*dstStride], (src5+src6)*20 - (src4+src7)*6 + (src3+src8)*3 - (src2+src8));\ | |
1816 OP(dst[6*dstStride], (src6+src7)*20 - (src5+src8)*6 + (src4+src8)*3 - (src3+src7));\ | |
1817 OP(dst[7*dstStride], (src7+src8)*20 - (src6+src8)*6 + (src5+src7)*3 - (src4+src6));\ | |
1818 dst++;\ | |
1819 src++;\ | |
1820 }\ | |
1821 }\ | |
1822 \ | |
1064 | 1823 static void OPNAME ## mpeg4_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ |
4176 | 1824 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
651 | 1825 int i;\ |
954 | 1826 \ |
651 | 1827 for(i=0; i<h; i++)\ |
1828 {\ | |
1829 OP(dst[ 0], (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]));\ | |
1830 OP(dst[ 1], (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]));\ | |
1831 OP(dst[ 2], (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]));\ | |
1832 OP(dst[ 3], (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]));\ | |
1833 OP(dst[ 4], (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]));\ | |
1834 OP(dst[ 5], (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]));\ | |
1835 OP(dst[ 6], (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]));\ | |
1836 OP(dst[ 7], (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]));\ | |
1837 OP(dst[ 8], (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]));\ | |
1838 OP(dst[ 9], (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]));\ | |
1839 OP(dst[10], (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]));\ | |
1840 OP(dst[11], (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]));\ | |
1841 OP(dst[12], (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]));\ | |
1842 OP(dst[13], (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]));\ | |
1843 OP(dst[14], (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]));\ | |
1844 OP(dst[15], (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]));\ | |
1845 dst+=dstStride;\ | |
1846 src+=srcStride;\ | |
1847 }\ | |
255 | 1848 }\ |
1849 \ | |
1064 | 1850 static void OPNAME ## mpeg4_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ |
4176 | 1851 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
651 | 1852 int i;\ |
954 | 1853 const int w=16;\ |
651 | 1854 for(i=0; i<w; i++)\ |
1855 {\ | |
1856 const int src0= src[0*srcStride];\ | |
1857 const int src1= src[1*srcStride];\ | |
1858 const int src2= src[2*srcStride];\ | |
1859 const int src3= src[3*srcStride];\ | |
1860 const int src4= src[4*srcStride];\ | |
1861 const int src5= src[5*srcStride];\ | |
1862 const int src6= src[6*srcStride];\ | |
1863 const int src7= src[7*srcStride];\ | |
1864 const int src8= src[8*srcStride];\ | |
1865 const int src9= src[9*srcStride];\ | |
1866 const int src10= src[10*srcStride];\ | |
1867 const int src11= src[11*srcStride];\ | |
1868 const int src12= src[12*srcStride];\ | |
1869 const int src13= src[13*srcStride];\ | |
1870 const int src14= src[14*srcStride];\ | |
1871 const int src15= src[15*srcStride];\ | |
1872 const int src16= src[16*srcStride];\ | |
1873 OP(dst[ 0*dstStride], (src0 +src1 )*20 - (src0 +src2 )*6 + (src1 +src3 )*3 - (src2 +src4 ));\ | |
1874 OP(dst[ 1*dstStride], (src1 +src2 )*20 - (src0 +src3 )*6 + (src0 +src4 )*3 - (src1 +src5 ));\ | |
1875 OP(dst[ 2*dstStride], (src2 +src3 )*20 - (src1 +src4 )*6 + (src0 +src5 )*3 - (src0 +src6 ));\ | |
1876 OP(dst[ 3*dstStride], (src3 +src4 )*20 - (src2 +src5 )*6 + (src1 +src6 )*3 - (src0 +src7 ));\ | |
1877 OP(dst[ 4*dstStride], (src4 +src5 )*20 - (src3 +src6 )*6 + (src2 +src7 )*3 - (src1 +src8 ));\ | |
1878 OP(dst[ 5*dstStride], (src5 +src6 )*20 - (src4 +src7 )*6 + (src3 +src8 )*3 - (src2 +src9 ));\ | |
1879 OP(dst[ 6*dstStride], (src6 +src7 )*20 - (src5 +src8 )*6 + (src4 +src9 )*3 - (src3 +src10));\ | |
1880 OP(dst[ 7*dstStride], (src7 +src8 )*20 - (src6 +src9 )*6 + (src5 +src10)*3 - (src4 +src11));\ | |
1881 OP(dst[ 8*dstStride], (src8 +src9 )*20 - (src7 +src10)*6 + (src6 +src11)*3 - (src5 +src12));\ | |
1882 OP(dst[ 9*dstStride], (src9 +src10)*20 - (src8 +src11)*6 + (src7 +src12)*3 - (src6 +src13));\ | |
1883 OP(dst[10*dstStride], (src10+src11)*20 - (src9 +src12)*6 + (src8 +src13)*3 - (src7 +src14));\ | |
1884 OP(dst[11*dstStride], (src11+src12)*20 - (src10+src13)*6 + (src9 +src14)*3 - (src8 +src15));\ | |
1885 OP(dst[12*dstStride], (src12+src13)*20 - (src11+src14)*6 + (src10+src15)*3 - (src9 +src16));\ | |
1886 OP(dst[13*dstStride], (src13+src14)*20 - (src12+src15)*6 + (src11+src16)*3 - (src10+src16));\ | |
1887 OP(dst[14*dstStride], (src14+src15)*20 - (src13+src16)*6 + (src12+src16)*3 - (src11+src15));\ | |
1888 OP(dst[15*dstStride], (src15+src16)*20 - (src14+src16)*6 + (src13+src15)*3 - (src12+src14));\ | |
1889 dst++;\ | |
1890 src++;\ | |
1891 }\ | |
255 | 1892 }\ |
1893 \ | |
1064 | 1894 static void OPNAME ## qpel8_mc00_c (uint8_t *dst, uint8_t *src, int stride){\ |
859 | 1895 OPNAME ## pixels8_c(dst, src, stride, 8);\ |
255 | 1896 }\ |
1897 \ | |
1064 | 1898 static void OPNAME ## qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){\ |
1899 uint8_t half[64];\ | |
651 | 1900 put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\ |
1901 OPNAME ## pixels8_l2(dst, src, half, stride, stride, 8, 8);\ | |
1902 }\ | |
1903 \ | |
1064 | 1904 static void OPNAME ## qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride){\ |
651 | 1905 OPNAME ## mpeg4_qpel8_h_lowpass(dst, src, stride, stride, 8);\ |
255 | 1906 }\ |
1907 \ | |
1064 | 1908 static void OPNAME ## qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride){\ |
1909 uint8_t half[64];\ | |
651 | 1910 put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\ |
1911 OPNAME ## pixels8_l2(dst, src+1, half, stride, stride, 8, 8);\ | |
1912 }\ | |
1913 \ | |
1064 | 1914 static void OPNAME ## qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride){\ |
1915 uint8_t full[16*9];\ | |
1916 uint8_t half[64];\ | |
651 | 1917 copy_block9(full, src, 16, stride, 9);\ |
984 | 1918 put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\ |
651 | 1919 OPNAME ## pixels8_l2(dst, full, half, stride, 16, 8, 8);\ |
1920 }\ | |
1921 \ | |
1064 | 1922 static void OPNAME ## qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride){\ |
1923 uint8_t full[16*9];\ | |
651 | 1924 copy_block9(full, src, 16, stride, 9);\ |
984 | 1925 OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16);\ |
255 | 1926 }\ |
1927 \ | |
1064 | 1928 static void OPNAME ## qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride){\ |
1929 uint8_t full[16*9];\ | |
1930 uint8_t half[64];\ | |
651 | 1931 copy_block9(full, src, 16, stride, 9);\ |
984 | 1932 put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\ |
651 | 1933 OPNAME ## pixels8_l2(dst, full+16, half, stride, 16, 8, 8);\ |
1934 }\ | |
1064 | 1935 void ff_ ## OPNAME ## qpel8_mc11_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
1936 uint8_t full[16*9];\ | |
1937 uint8_t halfH[72];\ | |
1938 uint8_t halfV[64];\ | |
1939 uint8_t halfHV[64];\ | |
651 | 1940 copy_block9(full, src, 16, stride, 9);\ |
1941 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
984 | 1942 put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\ |
1943 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
651 | 1944 OPNAME ## pixels8_l4(dst, full, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\ |
255 | 1945 }\ |
1064 | 1946 static void OPNAME ## qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride){\ |
1947 uint8_t full[16*9];\ | |
1948 uint8_t halfH[72];\ | |
1949 uint8_t halfHV[64];\ | |
984 | 1950 copy_block9(full, src, 16, stride, 9);\ |
1951 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
1952 put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\ | |
1953 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
1954 OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\ | |
1955 }\ | |
1064 | 1956 void ff_ ## OPNAME ## qpel8_mc31_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
1957 uint8_t full[16*9];\ | |
1958 uint8_t halfH[72];\ | |
1959 uint8_t halfV[64];\ | |
1960 uint8_t halfHV[64];\ | |
651 | 1961 copy_block9(full, src, 16, stride, 9);\ |
1962 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
984 | 1963 put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\ |
1964 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
651 | 1965 OPNAME ## pixels8_l4(dst, full+1, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\ |
255 | 1966 }\ |
1064 | 1967 static void OPNAME ## qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride){\ |
1968 uint8_t full[16*9];\ | |
1969 uint8_t halfH[72];\ | |
1970 uint8_t halfHV[64];\ | |
984 | 1971 copy_block9(full, src, 16, stride, 9);\ |
1972 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
1973 put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\ | |
1974 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
1975 OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\ | |
1976 }\ | |
1064 | 1977 void ff_ ## OPNAME ## qpel8_mc13_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
1978 uint8_t full[16*9];\ | |
1979 uint8_t halfH[72];\ | |
1980 uint8_t halfV[64];\ | |
1981 uint8_t halfHV[64];\ | |
651 | 1982 copy_block9(full, src, 16, stride, 9);\ |
1983 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
984 | 1984 put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\ |
1985 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
651 | 1986 OPNAME ## pixels8_l4(dst, full+16, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\ |
1987 }\ | |
1064 | 1988 static void OPNAME ## qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride){\ |
1989 uint8_t full[16*9];\ | |
1990 uint8_t halfH[72];\ | |
1991 uint8_t halfHV[64];\ | |
984 | 1992 copy_block9(full, src, 16, stride, 9);\ |
1993 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
1994 put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\ | |
1995 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
1996 OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\ | |
1997 }\ | |
1064 | 1998 void ff_ ## OPNAME ## qpel8_mc33_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
1999 uint8_t full[16*9];\ | |
2000 uint8_t halfH[72];\ | |
2001 uint8_t halfV[64];\ | |
2002 uint8_t halfHV[64];\ | |
651 | 2003 copy_block9(full, src, 16, stride, 9);\ |
2004 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full , 8, 16, 9);\ | |
984 | 2005 put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\ |
2006 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
651 | 2007 OPNAME ## pixels8_l4(dst, full+17, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\ |
255 | 2008 }\ |
1064 | 2009 static void OPNAME ## qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){\ |
2010 uint8_t full[16*9];\ | |
2011 uint8_t halfH[72];\ | |
2012 uint8_t halfHV[64];\ | |
984 | 2013 copy_block9(full, src, 16, stride, 9);\ |
2014 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
2015 put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\ | |
2016 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
2017 OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\ | |
2018 }\ | |
1064 | 2019 static void OPNAME ## qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride){\ |
2020 uint8_t halfH[72];\ | |
2021 uint8_t halfHV[64];\ | |
651 | 2022 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\ |
984 | 2023 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ |
651 | 2024 OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\ |
2025 }\ | |
1064 | 2026 static void OPNAME ## qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride){\ |
2027 uint8_t halfH[72];\ | |
2028 uint8_t halfHV[64];\ | |
651 | 2029 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\ |
984 | 2030 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ |
651 | 2031 OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\ |
2032 }\ | |
1064 | 2033 void ff_ ## OPNAME ## qpel8_mc12_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
2034 uint8_t full[16*9];\ | |
2035 uint8_t halfH[72];\ | |
2036 uint8_t halfV[64];\ | |
2037 uint8_t halfHV[64];\ | |
651 | 2038 copy_block9(full, src, 16, stride, 9);\ |
2039 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
984 | 2040 put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\ |
2041 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
651 | 2042 OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\ |
255 | 2043 }\ |
1064 | 2044 static void OPNAME ## qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride){\ |
2045 uint8_t full[16*9];\ | |
2046 uint8_t halfH[72];\ | |
984 | 2047 copy_block9(full, src, 16, stride, 9);\ |
2048 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
2049 put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\ | |
2050 OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\ | |
2051 }\ | |
1064 | 2052 void ff_ ## OPNAME ## qpel8_mc32_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
2053 uint8_t full[16*9];\ | |
2054 uint8_t halfH[72];\ | |
2055 uint8_t halfV[64];\ | |
2056 uint8_t halfHV[64];\ | |
651 | 2057 copy_block9(full, src, 16, stride, 9);\ |
2058 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
984 | 2059 put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\ |
2060 put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\ | |
651 | 2061 OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\ |
2062 }\ | |
1064 | 2063 static void OPNAME ## qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride){\ |
2064 uint8_t full[16*9];\ | |
2065 uint8_t halfH[72];\ | |
984 | 2066 copy_block9(full, src, 16, stride, 9);\ |
2067 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\ | |
2068 put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\ | |
2069 OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\ | |
2070 }\ | |
1064 | 2071 static void OPNAME ## qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){\ |
2072 uint8_t halfH[72];\ | |
651 | 2073 put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\ |
984 | 2074 OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\ |
651 | 2075 }\ |
1064 | 2076 static void OPNAME ## qpel16_mc00_c (uint8_t *dst, uint8_t *src, int stride){\ |
859 | 2077 OPNAME ## pixels16_c(dst, src, stride, 16);\ |
255 | 2078 }\ |
651 | 2079 \ |
1064 | 2080 static void OPNAME ## qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride){\ |
2081 uint8_t half[256];\ | |
651 | 2082 put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\ |
2083 OPNAME ## pixels16_l2(dst, src, half, stride, stride, 16, 16);\ | |
2084 }\ | |
2085 \ | |
1064 | 2086 static void OPNAME ## qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride){\ |
651 | 2087 OPNAME ## mpeg4_qpel16_h_lowpass(dst, src, stride, stride, 16);\ |
2088 }\ | |
2089 \ | |
1064 | 2090 static void OPNAME ## qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride){\ |
2091 uint8_t half[256];\ | |
651 | 2092 put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\ |
2093 OPNAME ## pixels16_l2(dst, src+1, half, stride, stride, 16, 16);\ | |
2094 }\ | |
2095 \ | |
1064 | 2096 static void OPNAME ## qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride){\ |
2097 uint8_t full[24*17];\ | |
2098 uint8_t half[256];\ | |
651 | 2099 copy_block17(full, src, 24, stride, 17);\ |
954 | 2100 put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\ |
651 | 2101 OPNAME ## pixels16_l2(dst, full, half, stride, 24, 16, 16);\ |
255 | 2102 }\ |
651 | 2103 \ |
1064 | 2104 static void OPNAME ## qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride){\ |
2105 uint8_t full[24*17];\ | |
651 | 2106 copy_block17(full, src, 24, stride, 17);\ |
954 | 2107 OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24);\ |
651 | 2108 }\ |
2109 \ | |
1064 | 2110 static void OPNAME ## qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride){\ |
2111 uint8_t full[24*17];\ | |
2112 uint8_t half[256];\ | |
651 | 2113 copy_block17(full, src, 24, stride, 17);\ |
954 | 2114 put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\ |
651 | 2115 OPNAME ## pixels16_l2(dst, full+24, half, stride, 24, 16, 16);\ |
255 | 2116 }\ |
1064 | 2117 void ff_ ## OPNAME ## qpel16_mc11_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
2118 uint8_t full[24*17];\ | |
2119 uint8_t halfH[272];\ | |
2120 uint8_t halfV[256];\ | |
2121 uint8_t halfHV[256];\ | |
651 | 2122 copy_block17(full, src, 24, stride, 17);\ |
2123 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
954 | 2124 put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\ |
2125 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
651 | 2126 OPNAME ## pixels16_l4(dst, full, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\ |
2127 }\ | |
1064 | 2128 static void OPNAME ## qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride){\ |
2129 uint8_t full[24*17];\ | |
2130 uint8_t halfH[272];\ | |
2131 uint8_t halfHV[256];\ | |
984 | 2132 copy_block17(full, src, 24, stride, 17);\ |
2133 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
2134 put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\ | |
2135 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
2136 OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\ | |
2137 }\ | |
1064 | 2138 void ff_ ## OPNAME ## qpel16_mc31_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
2139 uint8_t full[24*17];\ | |
2140 uint8_t halfH[272];\ | |
2141 uint8_t halfV[256];\ | |
2142 uint8_t halfHV[256];\ | |
651 | 2143 copy_block17(full, src, 24, stride, 17);\ |
2144 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
954 | 2145 put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\ |
2146 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
651 | 2147 OPNAME ## pixels16_l4(dst, full+1, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\ |
2148 }\ | |
1064 | 2149 static void OPNAME ## qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride){\ |
2150 uint8_t full[24*17];\ | |
2151 uint8_t halfH[272];\ | |
2152 uint8_t halfHV[256];\ | |
984 | 2153 copy_block17(full, src, 24, stride, 17);\ |
2154 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
2155 put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\ | |
2156 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
2157 OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\ | |
2158 }\ | |
1064 | 2159 void ff_ ## OPNAME ## qpel16_mc13_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
2160 uint8_t full[24*17];\ | |
2161 uint8_t halfH[272];\ | |
2162 uint8_t halfV[256];\ | |
2163 uint8_t halfHV[256];\ | |
651 | 2164 copy_block17(full, src, 24, stride, 17);\ |
2165 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
954 | 2166 put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\ |
2167 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
651 | 2168 OPNAME ## pixels16_l4(dst, full+24, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\ |
255 | 2169 }\ |
1064 | 2170 static void OPNAME ## qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride){\ |
2171 uint8_t full[24*17];\ | |
2172 uint8_t halfH[272];\ | |
2173 uint8_t halfHV[256];\ | |
984 | 2174 copy_block17(full, src, 24, stride, 17);\ |
2175 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
2176 put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\ | |
2177 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
2178 OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\ | |
2179 }\ | |
1064 | 2180 void ff_ ## OPNAME ## qpel16_mc33_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
2181 uint8_t full[24*17];\ | |
2182 uint8_t halfH[272];\ | |
2183 uint8_t halfV[256];\ | |
2184 uint8_t halfHV[256];\ | |
651 | 2185 copy_block17(full, src, 24, stride, 17);\ |
2186 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full , 16, 24, 17);\ | |
954 | 2187 put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\ |
2188 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
651 | 2189 OPNAME ## pixels16_l4(dst, full+25, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\ |
2190 }\ | |
1064 | 2191 static void OPNAME ## qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){\ |
2192 uint8_t full[24*17];\ | |
2193 uint8_t halfH[272];\ | |
2194 uint8_t halfHV[256];\ | |
984 | 2195 copy_block17(full, src, 24, stride, 17);\ |
2196 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
2197 put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\ | |
2198 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
2199 OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\ | |
2200 }\ | |
1064 | 2201 static void OPNAME ## qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride){\ |
2202 uint8_t halfH[272];\ | |
2203 uint8_t halfHV[256];\ | |
651 | 2204 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\ |
954 | 2205 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ |
651 | 2206 OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\ |
255 | 2207 }\ |
1064 | 2208 static void OPNAME ## qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride){\ |
2209 uint8_t halfH[272];\ | |
2210 uint8_t halfHV[256];\ | |
651 | 2211 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\ |
954 | 2212 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ |
651 | 2213 OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\ |
2214 }\ | |
1064 | 2215 void ff_ ## OPNAME ## qpel16_mc12_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
2216 uint8_t full[24*17];\ | |
2217 uint8_t halfH[272];\ | |
2218 uint8_t halfV[256];\ | |
2219 uint8_t halfHV[256];\ | |
651 | 2220 copy_block17(full, src, 24, stride, 17);\ |
2221 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
954 | 2222 put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\ |
2223 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
651 | 2224 OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\ |
255 | 2225 }\ |
1064 | 2226 static void OPNAME ## qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride){\ |
2227 uint8_t full[24*17];\ | |
2228 uint8_t halfH[272];\ | |
984 | 2229 copy_block17(full, src, 24, stride, 17);\ |
2230 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
2231 put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\ | |
2232 OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\ | |
2233 }\ | |
1064 | 2234 void ff_ ## OPNAME ## qpel16_mc32_old_c(uint8_t *dst, uint8_t *src, int stride){\ |
2235 uint8_t full[24*17];\ | |
2236 uint8_t halfH[272];\ | |
2237 uint8_t halfV[256];\ | |
2238 uint8_t halfHV[256];\ | |
651 | 2239 copy_block17(full, src, 24, stride, 17);\ |
2240 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
954 | 2241 put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\ |
2242 put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\ | |
651 | 2243 OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\ |
2244 }\ | |
1064 | 2245 static void OPNAME ## qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride){\ |
2246 uint8_t full[24*17];\ | |
2247 uint8_t halfH[272];\ | |
984 | 2248 copy_block17(full, src, 24, stride, 17);\ |
2249 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\ | |
2250 put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\ | |
2251 OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\ | |
2252 }\ | |
1064 | 2253 static void OPNAME ## qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride){\ |
2254 uint8_t halfH[272];\ | |
651 | 2255 put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\ |
954 | 2256 OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\ |
859 | 2257 } |
255 | 2258 |
651 | 2259 #define op_avg(a, b) a = (((a)+cm[((b) + 16)>>5]+1)>>1) |
2260 #define op_avg_no_rnd(a, b) a = (((a)+cm[((b) + 15)>>5])>>1) | |
2261 #define op_put(a, b) a = cm[((b) + 16)>>5] | |
2262 #define op_put_no_rnd(a, b) a = cm[((b) + 15)>>5] | |
2263 | |
2264 QPEL_MC(0, put_ , _ , op_put) | |
2265 QPEL_MC(1, put_no_rnd_, _no_rnd_, op_put_no_rnd) | |
2266 QPEL_MC(0, avg_ , _ , op_avg) | |
2267 //QPEL_MC(1, avg_no_rnd , _ , op_avg) | |
2268 #undef op_avg | |
2269 #undef op_avg_no_rnd | |
2270 #undef op_put | |
2271 #undef op_put_no_rnd | |
255 | 2272 |
1168 | 2273 #if 1 |
2274 #define H264_LOWPASS(OPNAME, OP, OP2) \ | |
5151 | 2275 static av_unused void OPNAME ## h264_qpel2_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ |
3020
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2276 const int h=2;\ |
4176 | 2277 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
3020
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2278 int i;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2279 for(i=0; i<h; i++)\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2280 {\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2281 OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2282 OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2283 dst+=dstStride;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2284 src+=srcStride;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2285 }\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2286 }\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2287 \ |
5151 | 2288 static av_unused void OPNAME ## h264_qpel2_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ |
3020
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2289 const int w=2;\ |
4176 | 2290 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
3020
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2291 int i;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2292 for(i=0; i<w; i++)\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2293 {\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2294 const int srcB= src[-2*srcStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2295 const int srcA= src[-1*srcStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2296 const int src0= src[0 *srcStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2297 const int src1= src[1 *srcStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2298 const int src2= src[2 *srcStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2299 const int src3= src[3 *srcStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2300 const int src4= src[4 *srcStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2301 OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2302 OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2303 dst++;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2304 src++;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2305 }\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2306 }\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2307 \ |
5151 | 2308 static av_unused void OPNAME ## h264_qpel2_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ |
3020
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2309 const int h=2;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2310 const int w=2;\ |
4176 | 2311 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
3020
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2312 int i;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2313 src -= 2*srcStride;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2314 for(i=0; i<h+5; i++)\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2315 {\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2316 tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]);\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2317 tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]);\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2318 tmp+=tmpStride;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2319 src+=srcStride;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2320 }\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2321 tmp -= tmpStride*(h+5-2);\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2322 for(i=0; i<w; i++)\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2323 {\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2324 const int tmpB= tmp[-2*tmpStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2325 const int tmpA= tmp[-1*tmpStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2326 const int tmp0= tmp[0 *tmpStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2327 const int tmp1= tmp[1 *tmpStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2328 const int tmp2= tmp[2 *tmpStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2329 const int tmp3= tmp[3 *tmpStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2330 const int tmp4= tmp[4 *tmpStride];\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2331 OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2332 OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2333 dst++;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2334 tmp++;\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2335 }\ |
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2336 }\ |
1168 | 2337 static void OPNAME ## h264_qpel4_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ |
2338 const int h=4;\ | |
4176 | 2339 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
1168 | 2340 int i;\ |
2341 for(i=0; i<h; i++)\ | |
2342 {\ | |
2343 OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\ | |
2344 OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\ | |
2345 OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]));\ | |
2346 OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]));\ | |
2347 dst+=dstStride;\ | |
2348 src+=srcStride;\ | |
2349 }\ | |
2350 }\ | |
2351 \ | |
2352 static void OPNAME ## h264_qpel4_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |
2353 const int w=4;\ | |
4176 | 2354 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
1168 | 2355 int i;\ |
2356 for(i=0; i<w; i++)\ | |
2357 {\ | |
2358 const int srcB= src[-2*srcStride];\ | |
2359 const int srcA= src[-1*srcStride];\ | |
2360 const int src0= src[0 *srcStride];\ | |
2361 const int src1= src[1 *srcStride];\ | |
2362 const int src2= src[2 *srcStride];\ | |
2363 const int src3= src[3 *srcStride];\ | |
2364 const int src4= src[4 *srcStride];\ | |
2365 const int src5= src[5 *srcStride];\ | |
2366 const int src6= src[6 *srcStride];\ | |
2367 OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\ | |
2368 OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\ | |
2369 OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\ | |
2370 OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\ | |
2371 dst++;\ | |
2372 src++;\ | |
2373 }\ | |
2374 }\ | |
2375 \ | |
2376 static void OPNAME ## h264_qpel4_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ | |
2377 const int h=4;\ | |
2378 const int w=4;\ | |
4176 | 2379 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
1168 | 2380 int i;\ |
2381 src -= 2*srcStride;\ | |
2382 for(i=0; i<h+5; i++)\ | |
2383 {\ | |
2384 tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]);\ | |
2385 tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]);\ | |
2386 tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]);\ | |
2387 tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]);\ | |
2388 tmp+=tmpStride;\ | |
2389 src+=srcStride;\ | |
2390 }\ | |
2391 tmp -= tmpStride*(h+5-2);\ | |
2392 for(i=0; i<w; i++)\ | |
2393 {\ | |
2394 const int tmpB= tmp[-2*tmpStride];\ | |
2395 const int tmpA= tmp[-1*tmpStride];\ | |
2396 const int tmp0= tmp[0 *tmpStride];\ | |
2397 const int tmp1= tmp[1 *tmpStride];\ | |
2398 const int tmp2= tmp[2 *tmpStride];\ | |
2399 const int tmp3= tmp[3 *tmpStride];\ | |
2400 const int tmp4= tmp[4 *tmpStride];\ | |
2401 const int tmp5= tmp[5 *tmpStride];\ | |
2402 const int tmp6= tmp[6 *tmpStride];\ | |
2403 OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\ | |
2404 OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\ | |
2405 OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\ | |
2406 OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\ | |
2407 dst++;\ | |
2408 tmp++;\ | |
2409 }\ | |
2410 }\ | |
2411 \ | |
2412 static void OPNAME ## h264_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |
2413 const int h=8;\ | |
4176 | 2414 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
1168 | 2415 int i;\ |
2416 for(i=0; i<h; i++)\ | |
2417 {\ | |
2418 OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]));\ | |
2419 OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]));\ | |
2420 OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]));\ | |
2421 OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]));\ | |
2422 OP(dst[4], (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]));\ | |
2423 OP(dst[5], (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]));\ | |
2424 OP(dst[6], (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]));\ | |
2425 OP(dst[7], (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]));\ | |
2426 dst+=dstStride;\ | |
2427 src+=srcStride;\ | |
2428 }\ | |
2429 }\ | |
2430 \ | |
2431 static void OPNAME ## h264_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |
2432 const int w=8;\ | |
4176 | 2433 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
1168 | 2434 int i;\ |
2435 for(i=0; i<w; i++)\ | |
2436 {\ | |
2437 const int srcB= src[-2*srcStride];\ | |
2438 const int srcA= src[-1*srcStride];\ | |
2439 const int src0= src[0 *srcStride];\ | |
2440 const int src1= src[1 *srcStride];\ | |
2441 const int src2= src[2 *srcStride];\ | |
2442 const int src3= src[3 *srcStride];\ | |
2443 const int src4= src[4 *srcStride];\ | |
2444 const int src5= src[5 *srcStride];\ | |
2445 const int src6= src[6 *srcStride];\ | |
2446 const int src7= src[7 *srcStride];\ | |
2447 const int src8= src[8 *srcStride];\ | |
2448 const int src9= src[9 *srcStride];\ | |
2449 const int src10=src[10*srcStride];\ | |
2450 OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\ | |
2451 OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\ | |
2452 OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\ | |
2453 OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\ | |
2454 OP(dst[4*dstStride], (src4+src5)*20 - (src3+src6)*5 + (src2+src7));\ | |
2455 OP(dst[5*dstStride], (src5+src6)*20 - (src4+src7)*5 + (src3+src8));\ | |
2456 OP(dst[6*dstStride], (src6+src7)*20 - (src5+src8)*5 + (src4+src9));\ | |
2457 OP(dst[7*dstStride], (src7+src8)*20 - (src6+src9)*5 + (src5+src10));\ | |
2458 dst++;\ | |
2459 src++;\ | |
2460 }\ | |
2461 }\ | |
2462 \ | |
2463 static void OPNAME ## h264_qpel8_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ | |
2464 const int h=8;\ | |
2465 const int w=8;\ | |
4176 | 2466 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ |
1168 | 2467 int i;\ |
2468 src -= 2*srcStride;\ | |
2469 for(i=0; i<h+5; i++)\ | |
2470 {\ | |
2471 tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]);\ | |
2472 tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]);\ | |
2473 tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]);\ | |
2474 tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]);\ | |
2475 tmp[4]= (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]);\ | |
2476 tmp[5]= (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]);\ | |
2477 tmp[6]= (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]);\ | |
2478 tmp[7]= (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]);\ | |
2479 tmp+=tmpStride;\ | |
2480 src+=srcStride;\ | |
2481 }\ | |
2482 tmp -= tmpStride*(h+5-2);\ | |
2483 for(i=0; i<w; i++)\ | |
2484 {\ | |
2485 const int tmpB= tmp[-2*tmpStride];\ | |
2486 const int tmpA= tmp[-1*tmpStride];\ | |
2487 const int tmp0= tmp[0 *tmpStride];\ | |
2488 const int tmp1= tmp[1 *tmpStride];\ | |
2489 const int tmp2= tmp[2 *tmpStride];\ | |
2490 const int tmp3= tmp[3 *tmpStride];\ | |
2491 const int tmp4= tmp[4 *tmpStride];\ | |
2492 const int tmp5= tmp[5 *tmpStride];\ | |
2493 const int tmp6= tmp[6 *tmpStride];\ | |
2494 const int tmp7= tmp[7 *tmpStride];\ | |
2495 const int tmp8= tmp[8 *tmpStride];\ | |
2496 const int tmp9= tmp[9 *tmpStride];\ | |
2497 const int tmp10=tmp[10*tmpStride];\ | |
2498 OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\ | |
2499 OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\ | |
2500 OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\ | |
2501 OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\ | |
2502 OP2(dst[4*dstStride], (tmp4+tmp5)*20 - (tmp3+tmp6)*5 + (tmp2+tmp7));\ | |
2503 OP2(dst[5*dstStride], (tmp5+tmp6)*20 - (tmp4+tmp7)*5 + (tmp3+tmp8));\ | |
2504 OP2(dst[6*dstStride], (tmp6+tmp7)*20 - (tmp5+tmp8)*5 + (tmp4+tmp9));\ | |
2505 OP2(dst[7*dstStride], (tmp7+tmp8)*20 - (tmp6+tmp9)*5 + (tmp5+tmp10));\ | |
2506 dst++;\ | |
2507 tmp++;\ | |
2508 }\ | |
2509 }\ | |
2510 \ | |
2511 static void OPNAME ## h264_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |
2512 OPNAME ## h264_qpel8_v_lowpass(dst , src , dstStride, srcStride);\ | |
2513 OPNAME ## h264_qpel8_v_lowpass(dst+8, src+8, dstStride, srcStride);\ | |
2514 src += 8*srcStride;\ | |
2515 dst += 8*dstStride;\ | |
2516 OPNAME ## h264_qpel8_v_lowpass(dst , src , dstStride, srcStride);\ | |
2517 OPNAME ## h264_qpel8_v_lowpass(dst+8, src+8, dstStride, srcStride);\ | |
2518 }\ | |
2519 \ | |
2520 static void OPNAME ## h264_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |
2521 OPNAME ## h264_qpel8_h_lowpass(dst , src , dstStride, srcStride);\ | |
2522 OPNAME ## h264_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride);\ | |
2523 src += 8*srcStride;\ | |
2524 dst += 8*dstStride;\ | |
2525 OPNAME ## h264_qpel8_h_lowpass(dst , src , dstStride, srcStride);\ | |
2526 OPNAME ## h264_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride);\ | |
2527 }\ | |
2528 \ | |
2529 static void OPNAME ## h264_qpel16_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ | |
2530 OPNAME ## h264_qpel8_hv_lowpass(dst , tmp , src , dstStride, tmpStride, srcStride);\ | |
2531 OPNAME ## h264_qpel8_hv_lowpass(dst+8, tmp+8, src+8, dstStride, tmpStride, srcStride);\ | |
2532 src += 8*srcStride;\ | |
2533 dst += 8*dstStride;\ | |
2534 OPNAME ## h264_qpel8_hv_lowpass(dst , tmp , src , dstStride, tmpStride, srcStride);\ | |
2535 OPNAME ## h264_qpel8_hv_lowpass(dst+8, tmp+8, src+8, dstStride, tmpStride, srcStride);\ | |
2536 }\ | |
2537 | |
2538 #define H264_MC(OPNAME, SIZE) \ | |
2539 static void OPNAME ## h264_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\ | |
2540 OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\ | |
2541 }\ | |
2542 \ | |
2543 static void OPNAME ## h264_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2544 uint8_t half[SIZE*SIZE];\ | |
2545 put_h264_qpel ## SIZE ## _h_lowpass(half, src, SIZE, stride);\ | |
2546 OPNAME ## pixels ## SIZE ## _l2(dst, src, half, stride, stride, SIZE, SIZE);\ | |
2547 }\ | |
2548 \ | |
2549 static void OPNAME ## h264_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2550 OPNAME ## h264_qpel ## SIZE ## _h_lowpass(dst, src, stride, stride);\ | |
2551 }\ | |
2552 \ | |
2553 static void OPNAME ## h264_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2554 uint8_t half[SIZE*SIZE];\ | |
2555 put_h264_qpel ## SIZE ## _h_lowpass(half, src, SIZE, stride);\ | |
2556 OPNAME ## pixels ## SIZE ## _l2(dst, src+1, half, stride, stride, SIZE, SIZE);\ | |
2557 }\ | |
2558 \ | |
2559 static void OPNAME ## h264_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2560 uint8_t full[SIZE*(SIZE+5)];\ | |
2561 uint8_t * const full_mid= full + SIZE*2;\ | |
2562 uint8_t half[SIZE*SIZE];\ | |
2563 copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\ | |
2564 put_h264_qpel ## SIZE ## _v_lowpass(half, full_mid, SIZE, SIZE);\ | |
2565 OPNAME ## pixels ## SIZE ## _l2(dst, full_mid, half, stride, SIZE, SIZE, SIZE);\ | |
2566 }\ | |
2567 \ | |
2568 static void OPNAME ## h264_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2569 uint8_t full[SIZE*(SIZE+5)];\ | |
2570 uint8_t * const full_mid= full + SIZE*2;\ | |
2571 copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\ | |
2572 OPNAME ## h264_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE);\ | |
2573 }\ | |
2574 \ | |
2575 static void OPNAME ## h264_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2576 uint8_t full[SIZE*(SIZE+5)];\ | |
2577 uint8_t * const full_mid= full + SIZE*2;\ | |
2578 uint8_t half[SIZE*SIZE];\ | |
2579 copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\ | |
2580 put_h264_qpel ## SIZE ## _v_lowpass(half, full_mid, SIZE, SIZE);\ | |
2581 OPNAME ## pixels ## SIZE ## _l2(dst, full_mid+SIZE, half, stride, SIZE, SIZE, SIZE);\ | |
2582 }\ | |
2583 \ | |
2584 static void OPNAME ## h264_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2585 uint8_t full[SIZE*(SIZE+5)];\ | |
2586 uint8_t * const full_mid= full + SIZE*2;\ | |
2587 uint8_t halfH[SIZE*SIZE];\ | |
2588 uint8_t halfV[SIZE*SIZE];\ | |
2589 put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\ | |
2590 copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\ | |
2591 put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\ | |
2592 OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\ | |
2593 }\ | |
2594 \ | |
2595 static void OPNAME ## h264_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2596 uint8_t full[SIZE*(SIZE+5)];\ | |
2597 uint8_t * const full_mid= full + SIZE*2;\ | |
2598 uint8_t halfH[SIZE*SIZE];\ | |
2599 uint8_t halfV[SIZE*SIZE];\ | |
2600 put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\ | |
2601 copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\ | |
2602 put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\ | |
2603 OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\ | |
2604 }\ | |
2605 \ | |
2606 static void OPNAME ## h264_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2607 uint8_t full[SIZE*(SIZE+5)];\ | |
2608 uint8_t * const full_mid= full + SIZE*2;\ | |
2609 uint8_t halfH[SIZE*SIZE];\ | |
2610 uint8_t halfV[SIZE*SIZE];\ | |
2611 put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\ | |
2612 copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\ | |
2613 put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\ | |
2614 OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\ | |
2615 }\ | |
2616 \ | |
2617 static void OPNAME ## h264_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2618 uint8_t full[SIZE*(SIZE+5)];\ | |
2619 uint8_t * const full_mid= full + SIZE*2;\ | |
2620 uint8_t halfH[SIZE*SIZE];\ | |
2621 uint8_t halfV[SIZE*SIZE];\ | |
2622 put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\ | |
2623 copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\ | |
2624 put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\ | |
2625 OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\ | |
2626 }\ | |
2627 \ | |
2628 static void OPNAME ## h264_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2629 int16_t tmp[SIZE*(SIZE+5)];\ | |
2630 OPNAME ## h264_qpel ## SIZE ## _hv_lowpass(dst, tmp, src, stride, SIZE, stride);\ | |
2631 }\ | |
2632 \ | |
2633 static void OPNAME ## h264_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2634 int16_t tmp[SIZE*(SIZE+5)];\ | |
2635 uint8_t halfH[SIZE*SIZE];\ | |
2636 uint8_t halfHV[SIZE*SIZE];\ | |
2637 put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\ | |
2638 put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\ | |
2639 OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\ | |
2640 }\ | |
2641 \ | |
2642 static void OPNAME ## h264_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2643 int16_t tmp[SIZE*(SIZE+5)];\ | |
2644 uint8_t halfH[SIZE*SIZE];\ | |
2645 uint8_t halfHV[SIZE*SIZE];\ | |
2646 put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\ | |
2647 put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\ | |
2648 OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\ | |
2649 }\ | |
2650 \ | |
2651 static void OPNAME ## h264_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2652 uint8_t full[SIZE*(SIZE+5)];\ | |
2653 uint8_t * const full_mid= full + SIZE*2;\ | |
2654 int16_t tmp[SIZE*(SIZE+5)];\ | |
2655 uint8_t halfV[SIZE*SIZE];\ | |
2656 uint8_t halfHV[SIZE*SIZE];\ | |
2657 copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\ | |
2658 put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\ | |
2659 put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\ | |
2660 OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\ | |
2661 }\ | |
2662 \ | |
2663 static void OPNAME ## h264_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\ | |
2664 uint8_t full[SIZE*(SIZE+5)];\ | |
2665 uint8_t * const full_mid= full + SIZE*2;\ | |
2666 int16_t tmp[SIZE*(SIZE+5)];\ | |
2667 uint8_t halfV[SIZE*SIZE];\ | |
2668 uint8_t halfHV[SIZE*SIZE];\ | |
2669 copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\ | |
2670 put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\ | |
2671 put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\ | |
2672 OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\ | |
2673 }\ | |
2674 | |
2675 #define op_avg(a, b) a = (((a)+cm[((b) + 16)>>5]+1)>>1) | |
2676 //#define op_avg2(a, b) a = (((a)*w1+cm[((b) + 16)>>5]*w2 + o + 64)>>7) | |
2677 #define op_put(a, b) a = cm[((b) + 16)>>5] | |
2678 #define op2_avg(a, b) a = (((a)+cm[((b) + 512)>>10]+1)>>1) | |
2679 #define op2_put(a, b) a = cm[((b) + 512)>>10] | |
2680 | |
2681 H264_LOWPASS(put_ , op_put, op2_put) | |
2682 H264_LOWPASS(avg_ , op_avg, op2_avg) | |
3020
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
2683 H264_MC(put_, 2) |
1168 | 2684 H264_MC(put_, 4) |
2685 H264_MC(put_, 8) | |
2686 H264_MC(put_, 16) | |
2687 H264_MC(avg_, 4) | |
2688 H264_MC(avg_, 8) | |
2689 H264_MC(avg_, 16) | |
2690 | |
2691 #undef op_avg | |
2692 #undef op_put | |
2693 #undef op2_avg | |
2694 #undef op2_put | |
2695 #endif | |
2696 | |
4594 | 2697 #define op_scale1(x) block[x] = av_clip_uint8( (block[x]*weight + offset) >> log2_denom ) |
2698 #define op_scale2(x) dst[x] = av_clip_uint8( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1)) | |
2415 | 2699 #define H264_WEIGHT(W,H) \ |
2700 static void weight_h264_pixels ## W ## x ## H ## _c(uint8_t *block, int stride, int log2_denom, int weight, int offset){ \ | |
3029 | 2701 int y; \ |
2415 | 2702 offset <<= log2_denom; \ |
2703 if(log2_denom) offset += 1<<(log2_denom-1); \ | |
2704 for(y=0; y<H; y++, block += stride){ \ | |
2705 op_scale1(0); \ | |
2706 op_scale1(1); \ | |
2707 if(W==2) continue; \ | |
2708 op_scale1(2); \ | |
2709 op_scale1(3); \ | |
2710 if(W==4) continue; \ | |
2711 op_scale1(4); \ | |
2712 op_scale1(5); \ | |
2713 op_scale1(6); \ | |
2714 op_scale1(7); \ | |
2715 if(W==8) continue; \ | |
2716 op_scale1(8); \ | |
2717 op_scale1(9); \ | |
2718 op_scale1(10); \ | |
2719 op_scale1(11); \ | |
2720 op_scale1(12); \ | |
2721 op_scale1(13); \ | |
2722 op_scale1(14); \ | |
2723 op_scale1(15); \ | |
2724 } \ | |
2725 } \ | |
3029 | 2726 static void biweight_h264_pixels ## W ## x ## H ## _c(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset){ \ |
2727 int y; \ | |
2728 offset = ((offset + 1) | 1) << log2_denom; \ | |
2415 | 2729 for(y=0; y<H; y++, dst += stride, src += stride){ \ |
2730 op_scale2(0); \ | |
2731 op_scale2(1); \ | |
2732 if(W==2) continue; \ | |
2733 op_scale2(2); \ | |
2734 op_scale2(3); \ | |
2735 if(W==4) continue; \ | |
2736 op_scale2(4); \ | |
2737 op_scale2(5); \ | |
2738 op_scale2(6); \ | |
2739 op_scale2(7); \ | |
2740 if(W==8) continue; \ | |
2741 op_scale2(8); \ | |
2742 op_scale2(9); \ | |
2743 op_scale2(10); \ | |
2744 op_scale2(11); \ | |
2745 op_scale2(12); \ | |
2746 op_scale2(13); \ | |
2747 op_scale2(14); \ | |
2748 op_scale2(15); \ | |
2749 } \ | |
2750 } | |
2751 | |
2752 H264_WEIGHT(16,16) | |
2753 H264_WEIGHT(16,8) | |
2754 H264_WEIGHT(8,16) | |
2755 H264_WEIGHT(8,8) | |
2756 H264_WEIGHT(8,4) | |
2757 H264_WEIGHT(4,8) | |
2758 H264_WEIGHT(4,4) | |
2759 H264_WEIGHT(4,2) | |
2760 H264_WEIGHT(2,4) | |
2761 H264_WEIGHT(2,2) | |
2762 | |
2763 #undef op_scale1 | |
2764 #undef op_scale2 | |
2765 #undef H264_WEIGHT | |
2766 | |
936 | 2767 static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ |
4176 | 2768 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
936 | 2769 int i; |
2770 | |
2771 for(i=0; i<h; i++){ | |
2772 dst[0]= cm[(9*(src[0] + src[1]) - (src[-1] + src[2]) + 8)>>4]; | |
2773 dst[1]= cm[(9*(src[1] + src[2]) - (src[ 0] + src[3]) + 8)>>4]; | |
2774 dst[2]= cm[(9*(src[2] + src[3]) - (src[ 1] + src[4]) + 8)>>4]; | |
2775 dst[3]= cm[(9*(src[3] + src[4]) - (src[ 2] + src[5]) + 8)>>4]; | |
2776 dst[4]= cm[(9*(src[4] + src[5]) - (src[ 3] + src[6]) + 8)>>4]; | |
2777 dst[5]= cm[(9*(src[5] + src[6]) - (src[ 4] + src[7]) + 8)>>4]; | |
2778 dst[6]= cm[(9*(src[6] + src[7]) - (src[ 5] + src[8]) + 8)>>4]; | |
2779 dst[7]= cm[(9*(src[7] + src[8]) - (src[ 6] + src[9]) + 8)>>4]; | |
2780 dst+=dstStride; | |
2967 | 2781 src+=srcStride; |
936 | 2782 } |
2783 } | |
2784 | |
8590 | 2785 #if CONFIG_CAVS_DECODER |
3395
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2786 /* AVS specific */ |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2787 void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) { |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2788 put_pixels8_c(dst, src, stride, 8); |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2789 } |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2790 void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) { |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2791 avg_pixels8_c(dst, src, stride, 8); |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2792 } |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2793 void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) { |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2794 put_pixels16_c(dst, src, stride, 16); |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2795 } |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2796 void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) { |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2797 avg_pixels16_c(dst, src, stride, 16); |
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2798 } |
3432 | 2799 #endif /* CONFIG_CAVS_DECODER */ |
3395
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
2800 |
9995
3141f69e3905
Do not check for both CONFIG_VC1_DECODER and CONFIG_WMV3_DECODER,
diego
parents:
9975
diff
changeset
|
2801 #if CONFIG_VC1_DECODER |
3526 | 2802 /* VC-1 specific */ |
11378
f46b68960464
Move some VC1 dsp prototypes to dsputil.h; they are defined in dsputil.c
mru
parents:
11376
diff
changeset
|
2803 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { |
3526 | 2804 put_pixels8_c(dst, src, stride, 8); |
2805 } | |
11378
f46b68960464
Move some VC1 dsp prototypes to dsputil.h; they are defined in dsputil.c
mru
parents:
11376
diff
changeset
|
2806 void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { |
9437 | 2807 avg_pixels8_c(dst, src, stride, 8); |
2808 } | |
9995
3141f69e3905
Do not check for both CONFIG_VC1_DECODER and CONFIG_WMV3_DECODER,
diego
parents:
9975
diff
changeset
|
2809 #endif /* CONFIG_VC1_DECODER */ |
3526 | 2810 |
4296 | 2811 /* H264 specific */ |
5411
362aec4ef932
Take care of some renames (Doxygen and function name) after the previous pure rename patch.
takis
parents:
5394
diff
changeset
|
2812 void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx); |
4296 | 2813 |
8590 | 2814 #if CONFIG_RV40_DECODER |
8232 | 2815 static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){ |
2816 put_pixels16_xy2_c(dst, src, stride, 16); | |
2817 } | |
2818 static void avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){ | |
2819 avg_pixels16_xy2_c(dst, src, stride, 16); | |
2820 } | |
2821 static void put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){ | |
2822 put_pixels8_xy2_c(dst, src, stride, 8); | |
2823 } | |
2824 static void avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){ | |
2825 avg_pixels8_xy2_c(dst, src, stride, 8); | |
2826 } | |
2827 #endif /* CONFIG_RV40_DECODER */ | |
2828 | |
936 | 2829 static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){ |
4176 | 2830 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
936 | 2831 int i; |
2832 | |
2833 for(i=0; i<w; i++){ | |
2834 const int src_1= src[ -srcStride]; | |
2835 const int src0 = src[0 ]; | |
2836 const int src1 = src[ srcStride]; | |
2837 const int src2 = src[2*srcStride]; | |
2838 const int src3 = src[3*srcStride]; | |
2839 const int src4 = src[4*srcStride]; | |
2840 const int src5 = src[5*srcStride]; | |
2841 const int src6 = src[6*srcStride]; | |
2842 const int src7 = src[7*srcStride]; | |
2843 const int src8 = src[8*srcStride]; | |
2844 const int src9 = src[9*srcStride]; | |
2845 dst[0*dstStride]= cm[(9*(src0 + src1) - (src_1 + src2) + 8)>>4]; | |
2846 dst[1*dstStride]= cm[(9*(src1 + src2) - (src0 + src3) + 8)>>4]; | |
2847 dst[2*dstStride]= cm[(9*(src2 + src3) - (src1 + src4) + 8)>>4]; | |
2848 dst[3*dstStride]= cm[(9*(src3 + src4) - (src2 + src5) + 8)>>4]; | |
2849 dst[4*dstStride]= cm[(9*(src4 + src5) - (src3 + src6) + 8)>>4]; | |
2850 dst[5*dstStride]= cm[(9*(src5 + src6) - (src4 + src7) + 8)>>4]; | |
2851 dst[6*dstStride]= cm[(9*(src6 + src7) - (src5 + src8) + 8)>>4]; | |
2852 dst[7*dstStride]= cm[(9*(src7 + src8) - (src6 + src9) + 8)>>4]; | |
2853 src++; | |
2854 dst++; | |
2855 } | |
2856 } | |
2857 | |
2858 static void put_mspel8_mc00_c (uint8_t *dst, uint8_t *src, int stride){ | |
2859 put_pixels8_c(dst, src, stride, 8); | |
2860 } | |
2861 | |
2862 static void put_mspel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){ | |
2863 uint8_t half[64]; | |
2864 wmv2_mspel8_h_lowpass(half, src, 8, stride, 8); | |
2865 put_pixels8_l2(dst, src, half, stride, stride, 8, 8); | |
2866 } | |
2867 | |
2868 static void put_mspel8_mc20_c(uint8_t *dst, uint8_t *src, int stride){ | |
2869 wmv2_mspel8_h_lowpass(dst, src, stride, stride, 8); | |
2870 } | |
2871 | |
2872 static void put_mspel8_mc30_c(uint8_t *dst, uint8_t *src, int stride){ | |
2873 uint8_t half[64]; | |
2874 wmv2_mspel8_h_lowpass(half, src, 8, stride, 8); | |
2875 put_pixels8_l2(dst, src+1, half, stride, stride, 8, 8); | |
2876 } | |
2877 | |
2878 static void put_mspel8_mc02_c(uint8_t *dst, uint8_t *src, int stride){ | |
2879 wmv2_mspel8_v_lowpass(dst, src, stride, stride, 8); | |
2880 } | |
2881 | |
2882 static void put_mspel8_mc12_c(uint8_t *dst, uint8_t *src, int stride){ | |
2883 uint8_t halfH[88]; | |
2884 uint8_t halfV[64]; | |
2885 uint8_t halfHV[64]; | |
2886 wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11); | |
2887 wmv2_mspel8_v_lowpass(halfV, src, 8, stride, 8); | |
2888 wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8); | |
2889 put_pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8); | |
2890 } | |
2891 static void put_mspel8_mc32_c(uint8_t *dst, uint8_t *src, int stride){ | |
2892 uint8_t halfH[88]; | |
2893 uint8_t halfV[64]; | |
2894 uint8_t halfHV[64]; | |
2895 wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11); | |
2896 wmv2_mspel8_v_lowpass(halfV, src+1, 8, stride, 8); | |
2897 wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8); | |
2898 put_pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8); | |
2899 } | |
2900 static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){ | |
2901 uint8_t halfH[88]; | |
2902 wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11); | |
2903 wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8); | |
2904 } | |
2905 | |
1644 | 2906 static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ |
10749
5cca4b6c459d
Get rid of pointless CONFIG_ANY_H263 preprocessor definition.
diego
parents:
10748
diff
changeset
|
2907 if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { |
1644 | 2908 int x; |
2909 const int strength= ff_h263_loop_filter_strength[qscale]; | |
2967 | 2910 |
1644 | 2911 for(x=0; x<8; x++){ |
2912 int d1, d2, ad1; | |
2913 int p0= src[x-2*stride]; | |
2914 int p1= src[x-1*stride]; | |
2915 int p2= src[x+0*stride]; | |
2916 int p3= src[x+1*stride]; | |
2917 int d = (p0 - p3 + 4*(p2 - p1)) / 8; | |
2918 | |
2919 if (d<-2*strength) d1= 0; | |
2920 else if(d<- strength) d1=-2*strength - d; | |
2921 else if(d< strength) d1= d; | |
2922 else if(d< 2*strength) d1= 2*strength - d; | |
2923 else d1= 0; | |
2967 | 2924 |
1644 | 2925 p1 += d1; |
2926 p2 -= d1; | |
2927 if(p1&256) p1= ~(p1>>31); | |
2928 if(p2&256) p2= ~(p2>>31); | |
2967 | 2929 |
1644 | 2930 src[x-1*stride] = p1; |
2931 src[x+0*stride] = p2; | |
2932 | |
4001 | 2933 ad1= FFABS(d1)>>1; |
2967 | 2934 |
4594 | 2935 d2= av_clip((p0-p3)/4, -ad1, ad1); |
2967 | 2936 |
1644 | 2937 src[x-2*stride] = p0 - d2; |
2938 src[x+ stride] = p3 + d2; | |
2939 } | |
5394
e9a6215f4e3a
help some gcc version to optimize out those functions
aurel
parents:
5291
diff
changeset
|
2940 } |
1644 | 2941 } |
2942 | |
2943 static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ | |
10749
5cca4b6c459d
Get rid of pointless CONFIG_ANY_H263 preprocessor definition.
diego
parents:
10748
diff
changeset
|
2944 if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { |
1644 | 2945 int y; |
2946 const int strength= ff_h263_loop_filter_strength[qscale]; | |
2967 | 2947 |
1644 | 2948 for(y=0; y<8; y++){ |
2949 int d1, d2, ad1; | |
2950 int p0= src[y*stride-2]; | |
2951 int p1= src[y*stride-1]; | |
2952 int p2= src[y*stride+0]; | |
2953 int p3= src[y*stride+1]; | |
2954 int d = (p0 - p3 + 4*(p2 - p1)) / 8; | |
2955 | |
2956 if (d<-2*strength) d1= 0; | |
2957 else if(d<- strength) d1=-2*strength - d; | |
2958 else if(d< strength) d1= d; | |
2959 else if(d< 2*strength) d1= 2*strength - d; | |
2960 else d1= 0; | |
2967 | 2961 |
1644 | 2962 p1 += d1; |
2963 p2 -= d1; | |
2964 if(p1&256) p1= ~(p1>>31); | |
2965 if(p2&256) p2= ~(p2>>31); | |
2967 | 2966 |
1644 | 2967 src[y*stride-1] = p1; |
2968 src[y*stride+0] = p2; | |
2969 | |
4001 | 2970 ad1= FFABS(d1)>>1; |
2967 | 2971 |
4594 | 2972 d2= av_clip((p0-p3)/4, -ad1, ad1); |
2967 | 2973 |
1644 | 2974 src[y*stride-2] = p0 - d2; |
2975 src[y*stride+1] = p3 + d2; | |
2976 } | |
5394
e9a6215f4e3a
help some gcc version to optimize out those functions
aurel
parents:
5291
diff
changeset
|
2977 } |
1644 | 2978 } |
936 | 2979 |
2045 | 2980 static void h261_loop_filter_c(uint8_t *src, int stride){ |
2981 int x,y,xy,yz; | |
2982 int temp[64]; | |
2983 | |
2984 for(x=0; x<8; x++){ | |
2985 temp[x ] = 4*src[x ]; | |
2986 temp[x + 7*8] = 4*src[x + 7*stride]; | |
2987 } | |
2988 for(y=1; y<7; y++){ | |
2989 for(x=0; x<8; x++){ | |
2990 xy = y * stride + x; | |
2991 yz = y * 8 + x; | |
2992 temp[yz] = src[xy - stride] + 2*src[xy] + src[xy + stride]; | |
2044
b6f2add2511e
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
1984
diff
changeset
|
2993 } |
b6f2add2511e
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
1984
diff
changeset
|
2994 } |
2967 | 2995 |
2045 | 2996 for(y=0; y<8; y++){ |
2997 src[ y*stride] = (temp[ y*8] + 2)>>2; | |
2998 src[7+y*stride] = (temp[7+y*8] + 2)>>2; | |
2999 for(x=1; x<7; x++){ | |
3000 xy = y * stride + x; | |
3001 yz = y * 8 + x; | |
3002 src[xy] = (temp[yz-1] + 2*temp[yz] + temp[yz+1] + 8)>>4; | |
2044
b6f2add2511e
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
1984
diff
changeset
|
3003 } |
b6f2add2511e
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
1984
diff
changeset
|
3004 } |
b6f2add2511e
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
1984
diff
changeset
|
3005 } |
b6f2add2511e
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
1984
diff
changeset
|
3006 |
10941
28edcc8c54c0
Mark the h264 c loop filter as av_always_inline av_flatten to make sure its
michael
parents:
10940
diff
changeset
|
3007 static av_always_inline av_flatten void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0) |
2633 | 3008 { |
3009 int i, d; | |
3010 for( i = 0; i < 4; i++ ) { | |
3011 if( tc0[i] < 0 ) { | |
3012 pix += 4*ystride; | |
3013 continue; | |
3014 } | |
3015 for( d = 0; d < 4; d++ ) { | |
3016 const int p0 = pix[-1*xstride]; | |
3017 const int p1 = pix[-2*xstride]; | |
3018 const int p2 = pix[-3*xstride]; | |
3019 const int q0 = pix[0]; | |
3020 const int q1 = pix[1*xstride]; | |
3021 const int q2 = pix[2*xstride]; | |
2967 | 3022 |
4001 | 3023 if( FFABS( p0 - q0 ) < alpha && |
3024 FFABS( p1 - p0 ) < beta && | |
3025 FFABS( q1 - q0 ) < beta ) { | |
2967 | 3026 |
2633 | 3027 int tc = tc0[i]; |
3028 int i_delta; | |
2967 | 3029 |
4001 | 3030 if( FFABS( p2 - p0 ) < beta ) { |
10940
563cb9b1a9b7
skip outer pixels if possible in h264_loop_filter_luma_c().
michael
parents:
10878
diff
changeset
|
3031 if(tc0[i]) |
4594 | 3032 pix[-2*xstride] = p1 + av_clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] ); |
2633 | 3033 tc++; |
3034 } | |
4001 | 3035 if( FFABS( q2 - q0 ) < beta ) { |
10940
563cb9b1a9b7
skip outer pixels if possible in h264_loop_filter_luma_c().
michael
parents:
10878
diff
changeset
|
3036 if(tc0[i]) |
4594 | 3037 pix[ xstride] = q1 + av_clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] ); |
2633 | 3038 tc++; |
3039 } | |
2967 | 3040 |
4594 | 3041 i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); |
3042 pix[-xstride] = av_clip_uint8( p0 + i_delta ); /* p0' */ | |
3043 pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */ | |
2633 | 3044 } |
3045 pix += ystride; | |
3046 } | |
3047 } | |
3048 } | |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3049 static void h264_v_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) |
2633 | 3050 { |
3051 h264_loop_filter_luma_c(pix, stride, 1, alpha, beta, tc0); | |
3052 } | |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3053 static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) |
2633 | 3054 { |
3055 h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0); | |
3056 } | |
3057 | |
10941
28edcc8c54c0
Mark the h264 c loop filter as av_always_inline av_flatten to make sure its
michael
parents:
10940
diff
changeset
|
3058 static av_always_inline av_flatten void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) |
8395
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3059 { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3060 int d; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3061 for( d = 0; d < 16; d++ ) { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3062 const int p2 = pix[-3*xstride]; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3063 const int p1 = pix[-2*xstride]; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3064 const int p0 = pix[-1*xstride]; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3065 |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3066 const int q0 = pix[ 0*xstride]; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3067 const int q1 = pix[ 1*xstride]; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3068 const int q2 = pix[ 2*xstride]; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3069 |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3070 if( FFABS( p0 - q0 ) < alpha && |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3071 FFABS( p1 - p0 ) < beta && |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3072 FFABS( q1 - q0 ) < beta ) { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3073 |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3074 if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3075 if( FFABS( p2 - p0 ) < beta) |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3076 { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3077 const int p3 = pix[-4*xstride]; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3078 /* p0', p1', p2' */ |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3079 pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3080 pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3081 pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3082 } else { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3083 /* p0' */ |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3084 pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3085 } |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3086 if( FFABS( q2 - q0 ) < beta) |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3087 { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3088 const int q3 = pix[3*xstride]; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3089 /* q0', q1', q2' */ |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3090 pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3091 pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3092 pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3093 } else { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3094 /* q0' */ |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3095 pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3096 } |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3097 }else{ |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3098 /* p0', q0' */ |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3099 pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3100 pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3101 } |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3102 } |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3103 pix += ystride; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3104 } |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3105 } |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3106 static void h264_v_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta) |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3107 { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3108 h264_loop_filter_luma_intra_c(pix, stride, 1, alpha, beta); |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3109 } |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3110 static void h264_h_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta) |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3111 { |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3112 h264_loop_filter_luma_intra_c(pix, 1, stride, alpha, beta); |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3113 } |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
3114 |
10941
28edcc8c54c0
Mark the h264 c loop filter as av_always_inline av_flatten to make sure its
michael
parents:
10940
diff
changeset
|
3115 static av_always_inline av_flatten void h264_loop_filter_chroma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0) |
2633 | 3116 { |
3117 int i, d; | |
3118 for( i = 0; i < 4; i++ ) { | |
3119 const int tc = tc0[i]; | |
3120 if( tc <= 0 ) { | |
3121 pix += 2*ystride; | |
3122 continue; | |
3123 } | |
3124 for( d = 0; d < 2; d++ ) { | |
3125 const int p0 = pix[-1*xstride]; | |
3126 const int p1 = pix[-2*xstride]; | |
3127 const int q0 = pix[0]; | |
3128 const int q1 = pix[1*xstride]; | |
3129 | |
4001 | 3130 if( FFABS( p0 - q0 ) < alpha && |
3131 FFABS( p1 - p0 ) < beta && | |
3132 FFABS( q1 - q0 ) < beta ) { | |
2633 | 3133 |
4594 | 3134 int delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); |
3135 | |
3136 pix[-xstride] = av_clip_uint8( p0 + delta ); /* p0' */ | |
3137 pix[0] = av_clip_uint8( q0 - delta ); /* q0' */ | |
2633 | 3138 } |
3139 pix += ystride; | |
3140 } | |
3141 } | |
3142 } | |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3143 static void h264_v_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) |
2633 | 3144 { |
3145 h264_loop_filter_chroma_c(pix, stride, 1, alpha, beta, tc0); | |
3146 } | |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3147 static void h264_h_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) |
2633 | 3148 { |
3149 h264_loop_filter_chroma_c(pix, 1, stride, alpha, beta, tc0); | |
3150 } | |
3151 | |
10941
28edcc8c54c0
Mark the h264 c loop filter as av_always_inline av_flatten to make sure its
michael
parents:
10940
diff
changeset
|
3152 static av_always_inline av_flatten void h264_loop_filter_chroma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3153 { |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3154 int d; |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3155 for( d = 0; d < 8; d++ ) { |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3156 const int p0 = pix[-1*xstride]; |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3157 const int p1 = pix[-2*xstride]; |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3158 const int q0 = pix[0]; |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3159 const int q1 = pix[1*xstride]; |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3160 |
4001 | 3161 if( FFABS( p0 - q0 ) < alpha && |
3162 FFABS( p1 - p0 ) < beta && | |
3163 FFABS( q1 - q0 ) < beta ) { | |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3164 |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3165 pix[-xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3166 pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3167 } |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3168 pix += ystride; |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3169 } |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3170 } |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3171 static void h264_v_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta) |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3172 { |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3173 h264_loop_filter_chroma_intra_c(pix, stride, 1, alpha, beta); |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3174 } |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3175 static void h264_h_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta) |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3176 { |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3177 h264_loop_filter_chroma_intra_c(pix, 1, stride, alpha, beta); |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3178 } |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
3179 |
1708 | 3180 static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
0 | 3181 { |
3182 int s, i; | |
3183 | |
3184 s = 0; | |
1708 | 3185 for(i=0;i<h;i++) { |
0 | 3186 s += abs(pix1[0] - pix2[0]); |
3187 s += abs(pix1[1] - pix2[1]); | |
3188 s += abs(pix1[2] - pix2[2]); | |
3189 s += abs(pix1[3] - pix2[3]); | |
3190 s += abs(pix1[4] - pix2[4]); | |
3191 s += abs(pix1[5] - pix2[5]); | |
3192 s += abs(pix1[6] - pix2[6]); | |
3193 s += abs(pix1[7] - pix2[7]); | |
3194 s += abs(pix1[8] - pix2[8]); | |
3195 s += abs(pix1[9] - pix2[9]); | |
3196 s += abs(pix1[10] - pix2[10]); | |
3197 s += abs(pix1[11] - pix2[11]); | |
3198 s += abs(pix1[12] - pix2[12]); | |
3199 s += abs(pix1[13] - pix2[13]); | |
3200 s += abs(pix1[14] - pix2[14]); | |
3201 s += abs(pix1[15] - pix2[15]); | |
3202 pix1 += line_size; | |
3203 pix2 += line_size; | |
3204 } | |
3205 return s; | |
3206 } | |
3207 | |
1708 | 3208 static int pix_abs16_x2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
0 | 3209 { |
3210 int s, i; | |
3211 | |
3212 s = 0; | |
1708 | 3213 for(i=0;i<h;i++) { |
0 | 3214 s += abs(pix1[0] - avg2(pix2[0], pix2[1])); |
3215 s += abs(pix1[1] - avg2(pix2[1], pix2[2])); | |
3216 s += abs(pix1[2] - avg2(pix2[2], pix2[3])); | |
3217 s += abs(pix1[3] - avg2(pix2[3], pix2[4])); | |
3218 s += abs(pix1[4] - avg2(pix2[4], pix2[5])); | |
3219 s += abs(pix1[5] - avg2(pix2[5], pix2[6])); | |
3220 s += abs(pix1[6] - avg2(pix2[6], pix2[7])); | |
3221 s += abs(pix1[7] - avg2(pix2[7], pix2[8])); | |
3222 s += abs(pix1[8] - avg2(pix2[8], pix2[9])); | |
3223 s += abs(pix1[9] - avg2(pix2[9], pix2[10])); | |
3224 s += abs(pix1[10] - avg2(pix2[10], pix2[11])); | |
3225 s += abs(pix1[11] - avg2(pix2[11], pix2[12])); | |
3226 s += abs(pix1[12] - avg2(pix2[12], pix2[13])); | |
3227 s += abs(pix1[13] - avg2(pix2[13], pix2[14])); | |
3228 s += abs(pix1[14] - avg2(pix2[14], pix2[15])); | |
3229 s += abs(pix1[15] - avg2(pix2[15], pix2[16])); | |
3230 pix1 += line_size; | |
3231 pix2 += line_size; | |
3232 } | |
3233 return s; | |
3234 } | |
3235 | |
1708 | 3236 static int pix_abs16_y2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
0 | 3237 { |
3238 int s, i; | |
1064 | 3239 uint8_t *pix3 = pix2 + line_size; |
0 | 3240 |
3241 s = 0; | |
1708 | 3242 for(i=0;i<h;i++) { |
0 | 3243 s += abs(pix1[0] - avg2(pix2[0], pix3[0])); |
3244 s += abs(pix1[1] - avg2(pix2[1], pix3[1])); | |
3245 s += abs(pix1[2] - avg2(pix2[2], pix3[2])); | |
3246 s += abs(pix1[3] - avg2(pix2[3], pix3[3])); | |
3247 s += abs(pix1[4] - avg2(pix2[4], pix3[4])); | |
3248 s += abs(pix1[5] - avg2(pix2[5], pix3[5])); | |
3249 s += abs(pix1[6] - avg2(pix2[6], pix3[6])); | |
3250 s += abs(pix1[7] - avg2(pix2[7], pix3[7])); | |
3251 s += abs(pix1[8] - avg2(pix2[8], pix3[8])); | |
3252 s += abs(pix1[9] - avg2(pix2[9], pix3[9])); | |
3253 s += abs(pix1[10] - avg2(pix2[10], pix3[10])); | |
3254 s += abs(pix1[11] - avg2(pix2[11], pix3[11])); | |
3255 s += abs(pix1[12] - avg2(pix2[12], pix3[12])); | |
3256 s += abs(pix1[13] - avg2(pix2[13], pix3[13])); | |
3257 s += abs(pix1[14] - avg2(pix2[14], pix3[14])); | |
3258 s += abs(pix1[15] - avg2(pix2[15], pix3[15])); | |
3259 pix1 += line_size; | |
3260 pix2 += line_size; | |
3261 pix3 += line_size; | |
3262 } | |
3263 return s; | |
3264 } | |
3265 | |
1708 | 3266 static int pix_abs16_xy2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
0 | 3267 { |
3268 int s, i; | |
1064 | 3269 uint8_t *pix3 = pix2 + line_size; |
0 | 3270 |
3271 s = 0; | |
1708 | 3272 for(i=0;i<h;i++) { |
0 | 3273 s += abs(pix1[0] - avg4(pix2[0], pix2[1], pix3[0], pix3[1])); |
3274 s += abs(pix1[1] - avg4(pix2[1], pix2[2], pix3[1], pix3[2])); | |
3275 s += abs(pix1[2] - avg4(pix2[2], pix2[3], pix3[2], pix3[3])); | |
3276 s += abs(pix1[3] - avg4(pix2[3], pix2[4], pix3[3], pix3[4])); | |
3277 s += abs(pix1[4] - avg4(pix2[4], pix2[5], pix3[4], pix3[5])); | |
3278 s += abs(pix1[5] - avg4(pix2[5], pix2[6], pix3[5], pix3[6])); | |
3279 s += abs(pix1[6] - avg4(pix2[6], pix2[7], pix3[6], pix3[7])); | |
3280 s += abs(pix1[7] - avg4(pix2[7], pix2[8], pix3[7], pix3[8])); | |
3281 s += abs(pix1[8] - avg4(pix2[8], pix2[9], pix3[8], pix3[9])); | |
3282 s += abs(pix1[9] - avg4(pix2[9], pix2[10], pix3[9], pix3[10])); | |
3283 s += abs(pix1[10] - avg4(pix2[10], pix2[11], pix3[10], pix3[11])); | |
3284 s += abs(pix1[11] - avg4(pix2[11], pix2[12], pix3[11], pix3[12])); | |
3285 s += abs(pix1[12] - avg4(pix2[12], pix2[13], pix3[12], pix3[13])); | |
3286 s += abs(pix1[13] - avg4(pix2[13], pix2[14], pix3[13], pix3[14])); | |
3287 s += abs(pix1[14] - avg4(pix2[14], pix2[15], pix3[14], pix3[15])); | |
3288 s += abs(pix1[15] - avg4(pix2[15], pix2[16], pix3[15], pix3[16])); | |
3289 pix1 += line_size; | |
3290 pix2 += line_size; | |
3291 pix3 += line_size; | |
3292 } | |
3293 return s; | |
3294 } | |
3295 | |
1708 | 3296 static inline int pix_abs8_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
294 | 3297 { |
3298 int s, i; | |
3299 | |
3300 s = 0; | |
1708 | 3301 for(i=0;i<h;i++) { |
294 | 3302 s += abs(pix1[0] - pix2[0]); |
3303 s += abs(pix1[1] - pix2[1]); | |
3304 s += abs(pix1[2] - pix2[2]); | |
3305 s += abs(pix1[3] - pix2[3]); | |
3306 s += abs(pix1[4] - pix2[4]); | |
3307 s += abs(pix1[5] - pix2[5]); | |
3308 s += abs(pix1[6] - pix2[6]); | |
3309 s += abs(pix1[7] - pix2[7]); | |
3310 pix1 += line_size; | |
3311 pix2 += line_size; | |
3312 } | |
3313 return s; | |
3314 } | |
3315 | |
1708 | 3316 static int pix_abs8_x2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
294 | 3317 { |
3318 int s, i; | |
3319 | |
3320 s = 0; | |
1708 | 3321 for(i=0;i<h;i++) { |
294 | 3322 s += abs(pix1[0] - avg2(pix2[0], pix2[1])); |
3323 s += abs(pix1[1] - avg2(pix2[1], pix2[2])); | |
3324 s += abs(pix1[2] - avg2(pix2[2], pix2[3])); | |
3325 s += abs(pix1[3] - avg2(pix2[3], pix2[4])); | |
3326 s += abs(pix1[4] - avg2(pix2[4], pix2[5])); | |
3327 s += abs(pix1[5] - avg2(pix2[5], pix2[6])); | |
3328 s += abs(pix1[6] - avg2(pix2[6], pix2[7])); | |
3329 s += abs(pix1[7] - avg2(pix2[7], pix2[8])); | |
3330 pix1 += line_size; | |
3331 pix2 += line_size; | |
3332 } | |
3333 return s; | |
3334 } | |
3335 | |
1708 | 3336 static int pix_abs8_y2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
294 | 3337 { |
3338 int s, i; | |
1064 | 3339 uint8_t *pix3 = pix2 + line_size; |
294 | 3340 |
3341 s = 0; | |
1708 | 3342 for(i=0;i<h;i++) { |
294 | 3343 s += abs(pix1[0] - avg2(pix2[0], pix3[0])); |
3344 s += abs(pix1[1] - avg2(pix2[1], pix3[1])); | |
3345 s += abs(pix1[2] - avg2(pix2[2], pix3[2])); | |
3346 s += abs(pix1[3] - avg2(pix2[3], pix3[3])); | |
3347 s += abs(pix1[4] - avg2(pix2[4], pix3[4])); | |
3348 s += abs(pix1[5] - avg2(pix2[5], pix3[5])); | |
3349 s += abs(pix1[6] - avg2(pix2[6], pix3[6])); | |
3350 s += abs(pix1[7] - avg2(pix2[7], pix3[7])); | |
3351 pix1 += line_size; | |
3352 pix2 += line_size; | |
3353 pix3 += line_size; | |
3354 } | |
3355 return s; | |
3356 } | |
3357 | |
1708 | 3358 static int pix_abs8_xy2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
294 | 3359 { |
3360 int s, i; | |
1064 | 3361 uint8_t *pix3 = pix2 + line_size; |
294 | 3362 |
3363 s = 0; | |
1708 | 3364 for(i=0;i<h;i++) { |
294 | 3365 s += abs(pix1[0] - avg4(pix2[0], pix2[1], pix3[0], pix3[1])); |
3366 s += abs(pix1[1] - avg4(pix2[1], pix2[2], pix3[1], pix3[2])); | |
3367 s += abs(pix1[2] - avg4(pix2[2], pix2[3], pix3[2], pix3[3])); | |
3368 s += abs(pix1[3] - avg4(pix2[3], pix2[4], pix3[3], pix3[4])); | |
3369 s += abs(pix1[4] - avg4(pix2[4], pix2[5], pix3[4], pix3[5])); | |
3370 s += abs(pix1[5] - avg4(pix2[5], pix2[6], pix3[5], pix3[6])); | |
3371 s += abs(pix1[6] - avg4(pix2[6], pix2[7], pix3[6], pix3[7])); | |
3372 s += abs(pix1[7] - avg4(pix2[7], pix2[8], pix3[7], pix3[8])); | |
3373 pix1 += line_size; | |
3374 pix2 += line_size; | |
3375 pix3 += line_size; | |
3376 } | |
3377 return s; | |
3378 } | |
3379 | |
2834 | 3380 static int nsse16_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ |
3381 MpegEncContext *c = v; | |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3382 int score1=0; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3383 int score2=0; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3384 int x,y; |
2066 | 3385 |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3386 for(y=0; y<h; y++){ |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3387 for(x=0; x<16; x++){ |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3388 score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]); |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3389 } |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3390 if(y+1<h){ |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3391 for(x=0; x<15; x++){ |
4001 | 3392 score2+= FFABS( s1[x ] - s1[x +stride] |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3393 - s1[x+1] + s1[x+1+stride]) |
4001 | 3394 -FFABS( s2[x ] - s2[x +stride] |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3395 - s2[x+1] + s2[x+1+stride]); |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3396 } |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3397 } |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3398 s1+= stride; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3399 s2+= stride; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3400 } |
2066 | 3401 |
4001 | 3402 if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; |
3403 else return score1 + FFABS(score2)*8; | |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3404 } |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3405 |
2834 | 3406 static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ |
3407 MpegEncContext *c = v; | |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3408 int score1=0; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3409 int score2=0; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3410 int x,y; |
2967 | 3411 |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3412 for(y=0; y<h; y++){ |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3413 for(x=0; x<8; x++){ |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3414 score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]); |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3415 } |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3416 if(y+1<h){ |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3417 for(x=0; x<7; x++){ |
4001 | 3418 score2+= FFABS( s1[x ] - s1[x +stride] |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3419 - s1[x+1] + s1[x+1+stride]) |
4001 | 3420 -FFABS( s2[x ] - s2[x +stride] |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3421 - s2[x+1] + s2[x+1+stride]); |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3422 } |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3423 } |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3424 s1+= stride; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3425 s2+= stride; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3426 } |
2967 | 3427 |
4001 | 3428 if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; |
3429 else return score1 + FFABS(score2)*8; | |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3430 } |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3431 |
1784 | 3432 static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ |
3433 int i; | |
3434 unsigned int sum=0; | |
3435 | |
3436 for(i=0; i<8*8; i++){ | |
3437 int b= rem[i] + ((basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT)); | |
3438 int w= weight[i]; | |
3439 b>>= RECON_SHIFT; | |
3440 assert(-512<b && b<512); | |
3441 | |
3442 sum += (w*b)*(w*b)>>4; | |
3443 } | |
3444 return sum>>2; | |
3445 } | |
3446 | |
3447 static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){ | |
3448 int i; | |
3449 | |
3450 for(i=0; i<8*8; i++){ | |
3451 rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT); | |
2967 | 3452 } |
1784 | 3453 } |
3454 | |
1100 | 3455 /** |
3456 * permutes an 8x8 block. | |
1101 | 3457 * @param block the block which will be permuted according to the given permutation vector |
1100 | 3458 * @param permutation the permutation vector |
3459 * @param last the last non zero coefficient in scantable order, used to speed the permutation up | |
2967 | 3460 * @param scantable the used scantable, this is only used to speed the permutation up, the block is not |
1101 | 3461 * (inverse) permutated to scantable order! |
1100 | 3462 */ |
1064 | 3463 void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last) |
174
ac5075a55488
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
88
diff
changeset
|
3464 { |
764 | 3465 int i; |
945 | 3466 DCTELEM temp[64]; |
2967 | 3467 |
764 | 3468 if(last<=0) return; |
5129 | 3469 //if(permutation[1]==1) return; //FIXME it is ok but not clean and might fail for some permutations |
174
ac5075a55488
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
88
diff
changeset
|
3470 |
764 | 3471 for(i=0; i<=last; i++){ |
3472 const int j= scantable[i]; | |
3473 temp[j]= block[j]; | |
3474 block[j]=0; | |
3475 } | |
2967 | 3476 |
764 | 3477 for(i=0; i<=last; i++){ |
3478 const int j= scantable[i]; | |
3479 const int perm_j= permutation[j]; | |
3480 block[perm_j]= temp[j]; | |
3481 } | |
174
ac5075a55488
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
88
diff
changeset
|
3482 } |
34 | 3483 |
1729 | 3484 static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){ |
3485 return 0; | |
3486 } | |
3487 | |
3488 void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){ | |
3489 int i; | |
2967 | 3490 |
8976
e7d87561b42b
Making the arrays accomodate an extra intra 8x8 cmp function
romansh
parents:
8785
diff
changeset
|
3491 memset(cmp, 0, sizeof(void*)*6); |
e7d87561b42b
Making the arrays accomodate an extra intra 8x8 cmp function
romansh
parents:
8785
diff
changeset
|
3492 |
e7d87561b42b
Making the arrays accomodate an extra intra 8x8 cmp function
romansh
parents:
8785
diff
changeset
|
3493 for(i=0; i<6; i++){ |
1729 | 3494 switch(type&0xFF){ |
3495 case FF_CMP_SAD: | |
3496 cmp[i]= c->sad[i]; | |
3497 break; | |
3498 case FF_CMP_SATD: | |
3499 cmp[i]= c->hadamard8_diff[i]; | |
3500 break; | |
3501 case FF_CMP_SSE: | |
3502 cmp[i]= c->sse[i]; | |
3503 break; | |
3504 case FF_CMP_DCT: | |
3505 cmp[i]= c->dct_sad[i]; | |
3506 break; | |
3010
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3507 case FF_CMP_DCT264: |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3508 cmp[i]= c->dct264_sad[i]; |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3509 break; |
2382 | 3510 case FF_CMP_DCTMAX: |
3511 cmp[i]= c->dct_max[i]; | |
3512 break; | |
1729 | 3513 case FF_CMP_PSNR: |
3514 cmp[i]= c->quant_psnr[i]; | |
3515 break; | |
3516 case FF_CMP_BIT: | |
3517 cmp[i]= c->bit[i]; | |
3518 break; | |
3519 case FF_CMP_RD: | |
3520 cmp[i]= c->rd[i]; | |
3521 break; | |
3522 case FF_CMP_VSAD: | |
3523 cmp[i]= c->vsad[i]; | |
3524 break; | |
3525 case FF_CMP_VSSE: | |
3526 cmp[i]= c->vsse[i]; | |
3527 break; | |
3528 case FF_CMP_ZERO: | |
3529 cmp[i]= zero_cmp; | |
3530 break; | |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3531 case FF_CMP_NSSE: |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3532 cmp[i]= c->nsse[i]; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
3533 break; |
8590 | 3534 #if CONFIG_SNOW_ENCODER |
2184 | 3535 case FF_CMP_W53: |
3536 cmp[i]= c->w53[i]; | |
3537 break; | |
3538 case FF_CMP_W97: | |
3539 cmp[i]= c->w97[i]; | |
3540 break; | |
3373
b8996cc5ccae
Disable w53 and w97 cmp methods when snow encoder is disabled
gpoirier
parents:
3323
diff
changeset
|
3541 #endif |
1729 | 3542 default: |
3543 av_log(NULL, AV_LOG_ERROR,"internal error in cmp function selection\n"); | |
3544 } | |
3545 } | |
3546 } | |
3547 | |
8288 | 3548 static void clear_block_c(DCTELEM *block) |
3549 { | |
3550 memset(block, 0, sizeof(DCTELEM)*64); | |
3551 } | |
3552 | |
1101 | 3553 /** |
3554 * memset(blocks, 0, sizeof(DCTELEM)*6*64) | |
3555 */ | |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
3556 static void clear_blocks_c(DCTELEM *blocks) |
296 | 3557 { |
3558 memset(blocks, 0, sizeof(DCTELEM)*6*64); | |
3559 } | |
3560 | |
866 | 3561 static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ |
6385 | 3562 long i; |
3563 for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ | |
3564 long a = *(long*)(src+i); | |
3565 long b = *(long*)(dst+i); | |
3566 *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); | |
866 | 3567 } |
3568 for(; i<w; i++) | |
3569 dst[i+0] += src[i+0]; | |
3570 } | |
3571 | |
6384 | 3572 static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ |
6385 | 3573 long i; |
6384 | 3574 for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ |
3575 long a = *(long*)(src1+i); | |
3576 long b = *(long*)(src2+i); | |
6385 | 3577 *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); |
6384 | 3578 } |
3579 for(; i<w; i++) | |
3580 dst[i] = src1[i]+src2[i]; | |
3581 } | |
3582 | |
866 | 3583 static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ |
6385 | 3584 long i; |
8590 | 3585 #if !HAVE_FAST_UNALIGNED |
6385 | 3586 if((long)src2 & (sizeof(long)-1)){ |
6386 | 3587 for(i=0; i+7<w; i+=8){ |
3588 dst[i+0] = src1[i+0]-src2[i+0]; | |
3589 dst[i+1] = src1[i+1]-src2[i+1]; | |
3590 dst[i+2] = src1[i+2]-src2[i+2]; | |
3591 dst[i+3] = src1[i+3]-src2[i+3]; | |
3592 dst[i+4] = src1[i+4]-src2[i+4]; | |
3593 dst[i+5] = src1[i+5]-src2[i+5]; | |
3594 dst[i+6] = src1[i+6]-src2[i+6]; | |
3595 dst[i+7] = src1[i+7]-src2[i+7]; | |
3596 } | |
6385 | 3597 }else |
3598 #endif | |
3599 for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ | |
3600 long a = *(long*)(src1+i); | |
3601 long b = *(long*)(src2+i); | |
3602 *(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80); | |
3603 } | |
866 | 3604 for(; i<w; i++) |
3605 dst[i+0] = src1[i+0]-src2[i+0]; | |
3606 } | |
3607 | |
10431 | 3608 static void add_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const uint8_t *diff, int w, int *left, int *left_top){ |
8760 | 3609 int i; |
3610 uint8_t l, lt; | |
3611 | |
3612 l= *left; | |
3613 lt= *left_top; | |
3614 | |
3615 for(i=0; i<w; i++){ | |
3616 l= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF) + diff[i]; | |
3617 lt= src1[i]; | |
3618 dst[i]= l; | |
3619 } | |
3620 | |
3621 *left= l; | |
3622 *left_top= lt; | |
3623 } | |
3624 | |
10431 | 3625 static void sub_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top){ |
1527 | 3626 int i; |
3627 uint8_t l, lt; | |
3628 | |
3629 l= *left; | |
3630 lt= *left_top; | |
3631 | |
3632 for(i=0; i<w; i++){ | |
3633 const int pred= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF); | |
3634 lt= src1[i]; | |
3635 l= src2[i]; | |
3636 dst[i]= l - pred; | |
2967 | 3637 } |
1527 | 3638 |
3639 *left= l; | |
3640 *left_top= lt; | |
3641 } | |
3642 | |
10420
442ab0c41eae
Huffyuv: Add missing const to src pointers in dsputil functions.
astrange
parents:
10370
diff
changeset
|
3643 static int add_hfyu_left_prediction_c(uint8_t *dst, const uint8_t *src, int w, int acc){ |
10370 | 3644 int i; |
3645 | |
3646 for(i=0; i<w-1; i++){ | |
3647 acc+= src[i]; | |
3648 dst[i]= acc; | |
3649 i++; | |
3650 acc+= src[i]; | |
3651 dst[i]= acc; | |
3652 } | |
3653 | |
3654 for(; i<w; i++){ | |
3655 acc+= src[i]; | |
3656 dst[i]= acc; | |
3657 } | |
3658 | |
3659 return acc; | |
3660 } | |
3661 | |
3662 #if HAVE_BIGENDIAN | |
3663 #define B 3 | |
3664 #define G 2 | |
3665 #define R 1 | |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3666 #define A 0 |
10370 | 3667 #else |
3668 #define B 0 | |
3669 #define G 1 | |
3670 #define R 2 | |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3671 #define A 3 |
10370 | 3672 #endif |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3673 static void add_hfyu_left_prediction_bgr32_c(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha){ |
10370 | 3674 int i; |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3675 int r,g,b,a; |
10370 | 3676 r= *red; |
3677 g= *green; | |
3678 b= *blue; | |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3679 a= *alpha; |
10370 | 3680 |
3681 for(i=0; i<w; i++){ | |
3682 b+= src[4*i+B]; | |
3683 g+= src[4*i+G]; | |
3684 r+= src[4*i+R]; | |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3685 a+= src[4*i+A]; |
10370 | 3686 |
3687 dst[4*i+B]= b; | |
3688 dst[4*i+G]= g; | |
3689 dst[4*i+R]= r; | |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3690 dst[4*i+A]= a; |
10370 | 3691 } |
3692 | |
3693 *red= r; | |
3694 *green= g; | |
3695 *blue= b; | |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3696 *alpha= a; |
10370 | 3697 } |
3698 #undef B | |
3699 #undef G | |
3700 #undef R | |
10878
a8620b001ed3
Implement alpha channel decoding for BGR HuffYUV.
astrange
parents:
10867
diff
changeset
|
3701 #undef A |
10370 | 3702 |
936 | 3703 #define BUTTERFLY2(o1,o2,i1,i2) \ |
3704 o1= (i1)+(i2);\ | |
3705 o2= (i1)-(i2); | |
3706 | |
3707 #define BUTTERFLY1(x,y) \ | |
3708 {\ | |
3709 int a,b;\ | |
3710 a= x;\ | |
3711 b= y;\ | |
3712 x= a+b;\ | |
3713 y= a-b;\ | |
3714 } | |
3715 | |
4001 | 3716 #define BUTTERFLYA(x,y) (FFABS((x)+(y)) + FFABS((x)-(y))) |
936 | 3717 |
1708 | 3718 static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){ |
936 | 3719 int i; |
3720 int temp[64]; | |
3721 int sum=0; | |
2967 | 3722 |
1708 | 3723 assert(h==8); |
936 | 3724 |
3725 for(i=0; i<8; i++){ | |
3726 //FIXME try pointer walks | |
3727 BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0]-dst[stride*i+0],src[stride*i+1]-dst[stride*i+1]); | |
3728 BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2]-dst[stride*i+2],src[stride*i+3]-dst[stride*i+3]); | |
3729 BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4]-dst[stride*i+4],src[stride*i+5]-dst[stride*i+5]); | |
3730 BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6]-dst[stride*i+6],src[stride*i+7]-dst[stride*i+7]); | |
2967 | 3731 |
936 | 3732 BUTTERFLY1(temp[8*i+0], temp[8*i+2]); |
3733 BUTTERFLY1(temp[8*i+1], temp[8*i+3]); | |
3734 BUTTERFLY1(temp[8*i+4], temp[8*i+6]); | |
3735 BUTTERFLY1(temp[8*i+5], temp[8*i+7]); | |
2967 | 3736 |
936 | 3737 BUTTERFLY1(temp[8*i+0], temp[8*i+4]); |
3738 BUTTERFLY1(temp[8*i+1], temp[8*i+5]); | |
3739 BUTTERFLY1(temp[8*i+2], temp[8*i+6]); | |
3740 BUTTERFLY1(temp[8*i+3], temp[8*i+7]); | |
3741 } | |
3742 | |
3743 for(i=0; i<8; i++){ | |
3744 BUTTERFLY1(temp[8*0+i], temp[8*1+i]); | |
3745 BUTTERFLY1(temp[8*2+i], temp[8*3+i]); | |
3746 BUTTERFLY1(temp[8*4+i], temp[8*5+i]); | |
3747 BUTTERFLY1(temp[8*6+i], temp[8*7+i]); | |
2967 | 3748 |
936 | 3749 BUTTERFLY1(temp[8*0+i], temp[8*2+i]); |
3750 BUTTERFLY1(temp[8*1+i], temp[8*3+i]); | |
3751 BUTTERFLY1(temp[8*4+i], temp[8*6+i]); | |
3752 BUTTERFLY1(temp[8*5+i], temp[8*7+i]); | |
3753 | |
2967 | 3754 sum += |
936 | 3755 BUTTERFLYA(temp[8*0+i], temp[8*4+i]) |
3756 +BUTTERFLYA(temp[8*1+i], temp[8*5+i]) | |
3757 +BUTTERFLYA(temp[8*2+i], temp[8*6+i]) | |
3758 +BUTTERFLYA(temp[8*3+i], temp[8*7+i]); | |
3759 } | |
3760 #if 0 | |
3761 static int maxi=0; | |
3762 if(sum>maxi){ | |
3763 maxi=sum; | |
3764 printf("MAX:%d\n", maxi); | |
3765 } | |
3766 #endif | |
3767 return sum; | |
3768 } | |
3769 | |
1729 | 3770 static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_t *dummy, int stride, int h){ |
936 | 3771 int i; |
3772 int temp[64]; | |
3773 int sum=0; | |
2967 | 3774 |
1729 | 3775 assert(h==8); |
2967 | 3776 |
936 | 3777 for(i=0; i<8; i++){ |
3778 //FIXME try pointer walks | |
1729 | 3779 BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0],src[stride*i+1]); |
3780 BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2],src[stride*i+3]); | |
3781 BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4],src[stride*i+5]); | |
3782 BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6],src[stride*i+7]); | |
2967 | 3783 |
936 | 3784 BUTTERFLY1(temp[8*i+0], temp[8*i+2]); |
3785 BUTTERFLY1(temp[8*i+1], temp[8*i+3]); | |
3786 BUTTERFLY1(temp[8*i+4], temp[8*i+6]); | |
3787 BUTTERFLY1(temp[8*i+5], temp[8*i+7]); | |
2967 | 3788 |
936 | 3789 BUTTERFLY1(temp[8*i+0], temp[8*i+4]); |
3790 BUTTERFLY1(temp[8*i+1], temp[8*i+5]); | |
3791 BUTTERFLY1(temp[8*i+2], temp[8*i+6]); | |
3792 BUTTERFLY1(temp[8*i+3], temp[8*i+7]); | |
3793 } | |
3794 | |
3795 for(i=0; i<8; i++){ | |
3796 BUTTERFLY1(temp[8*0+i], temp[8*1+i]); | |
3797 BUTTERFLY1(temp[8*2+i], temp[8*3+i]); | |
3798 BUTTERFLY1(temp[8*4+i], temp[8*5+i]); | |
3799 BUTTERFLY1(temp[8*6+i], temp[8*7+i]); | |
2967 | 3800 |
936 | 3801 BUTTERFLY1(temp[8*0+i], temp[8*2+i]); |
3802 BUTTERFLY1(temp[8*1+i], temp[8*3+i]); | |
3803 BUTTERFLY1(temp[8*4+i], temp[8*6+i]); | |
3804 BUTTERFLY1(temp[8*5+i], temp[8*7+i]); | |
2967 | 3805 |
3806 sum += | |
936 | 3807 BUTTERFLYA(temp[8*0+i], temp[8*4+i]) |
3808 +BUTTERFLYA(temp[8*1+i], temp[8*5+i]) | |
3809 +BUTTERFLYA(temp[8*2+i], temp[8*6+i]) | |
3810 +BUTTERFLYA(temp[8*3+i], temp[8*7+i]); | |
3811 } | |
2967 | 3812 |
4001 | 3813 sum -= FFABS(temp[8*0] + temp[8*4]); // -mean |
2967 | 3814 |
936 | 3815 return sum; |
3816 } | |
3817 | |
1708 | 3818 static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ |
936 | 3819 MpegEncContext * const s= (MpegEncContext *)c; |
11195 | 3820 LOCAL_ALIGNED_16(DCTELEM, temp, [64]); |
2967 | 3821 |
1708 | 3822 assert(h==8); |
936 | 3823 |
3824 s->dsp.diff_pixels(temp, src1, src2, stride); | |
1092 | 3825 s->dsp.fdct(temp); |
4988
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
3826 return s->dsp.sum_abs_dctelem(temp); |
936 | 3827 } |
3828 | |
8590 | 3829 #if CONFIG_GPL |
3010
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3830 #define DCT8_1D {\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3831 const int s07 = SRC(0) + SRC(7);\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3832 const int s16 = SRC(1) + SRC(6);\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3833 const int s25 = SRC(2) + SRC(5);\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3834 const int s34 = SRC(3) + SRC(4);\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3835 const int a0 = s07 + s34;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3836 const int a1 = s16 + s25;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3837 const int a2 = s07 - s34;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3838 const int a3 = s16 - s25;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3839 const int d07 = SRC(0) - SRC(7);\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3840 const int d16 = SRC(1) - SRC(6);\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3841 const int d25 = SRC(2) - SRC(5);\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3842 const int d34 = SRC(3) - SRC(4);\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3843 const int a4 = d16 + d25 + (d07 + (d07>>1));\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3844 const int a5 = d07 - d34 - (d25 + (d25>>1));\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3845 const int a6 = d07 + d34 - (d16 + (d16>>1));\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3846 const int a7 = d16 - d25 + (d34 + (d34>>1));\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3847 DST(0, a0 + a1 ) ;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3848 DST(1, a4 + (a7>>2)) ;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3849 DST(2, a2 + (a3>>1)) ;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3850 DST(3, a5 + (a6>>2)) ;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3851 DST(4, a0 - a1 ) ;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3852 DST(5, a6 - (a5>>2)) ;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3853 DST(6, (a2>>1) - a3 ) ;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3854 DST(7, (a4>>2) - a7 ) ;\ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3855 } |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3856 |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3857 static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3858 MpegEncContext * const s= (MpegEncContext *)c; |
5256 | 3859 DCTELEM dct[8][8]; |
3010
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3860 int i; |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3861 int sum=0; |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3862 |
5256 | 3863 s->dsp.diff_pixels(dct[0], src1, src2, stride); |
3010
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3864 |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3865 #define SRC(x) dct[i][x] |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3866 #define DST(x,v) dct[i][x]= v |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3867 for( i = 0; i < 8; i++ ) |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3868 DCT8_1D |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3869 #undef SRC |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3870 #undef DST |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3871 |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3872 #define SRC(x) dct[x][i] |
4001 | 3873 #define DST(x,v) sum += FFABS(v) |
3010
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3874 for( i = 0; i < 8; i++ ) |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3875 DCT8_1D |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3876 #undef SRC |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3877 #undef DST |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3878 return sum; |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3879 } |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3880 #endif |
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
3881 |
2382 | 3882 static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ |
3883 MpegEncContext * const s= (MpegEncContext *)c; | |
11195 | 3884 LOCAL_ALIGNED_16(DCTELEM, temp, [64]); |
2382 | 3885 int sum=0, i; |
2967 | 3886 |
2382 | 3887 assert(h==8); |
3888 | |
3889 s->dsp.diff_pixels(temp, src1, src2, stride); | |
3890 s->dsp.fdct(temp); | |
3891 | |
3892 for(i=0; i<64; i++) | |
4001 | 3893 sum= FFMAX(sum, FFABS(temp[i])); |
2967 | 3894 |
2382 | 3895 return sum; |
3896 } | |
3897 | |
1708 | 3898 static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ |
936 | 3899 MpegEncContext * const s= (MpegEncContext *)c; |
11195 | 3900 LOCAL_ALIGNED_16(DCTELEM, temp, [64*2]); |
11193 | 3901 DCTELEM * const bak = temp+64; |
936 | 3902 int sum=0, i; |
3903 | |
1708 | 3904 assert(h==8); |
936 | 3905 s->mb_intra=0; |
2967 | 3906 |
936 | 3907 s->dsp.diff_pixels(temp, src1, src2, stride); |
2967 | 3908 |
936 | 3909 memcpy(bak, temp, 64*sizeof(DCTELEM)); |
2967 | 3910 |
1013 | 3911 s->block_last_index[0/*FIXME*/]= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); |
1689 | 3912 s->dct_unquantize_inter(s, temp, 0, s->qscale); |
6001 | 3913 ff_simple_idct(temp); //FIXME |
2967 | 3914 |
936 | 3915 for(i=0; i<64; i++) |
3916 sum+= (temp[i]-bak[i])*(temp[i]-bak[i]); | |
2967 | 3917 |
936 | 3918 return sum; |
3919 } | |
3920 | |
1708 | 3921 static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ |
1007 | 3922 MpegEncContext * const s= (MpegEncContext *)c; |
1064 | 3923 const uint8_t *scantable= s->intra_scantable.permutated; |
11195 | 3924 LOCAL_ALIGNED_16(DCTELEM, temp, [64]); |
3925 LOCAL_ALIGNED_16(uint8_t, lsrc1, [64]); | |
3926 LOCAL_ALIGNED_16(uint8_t, lsrc2, [64]); | |
6719 | 3927 int i, last, run, bits, level, distortion, start_i; |
1007 | 3928 const int esc_length= s->ac_esc_length; |
3929 uint8_t * length; | |
3930 uint8_t * last_length; | |
2967 | 3931 |
1708 | 3932 assert(h==8); |
3933 | |
10068 | 3934 copy_block8(lsrc1, src1, 8, stride, 8); |
3935 copy_block8(lsrc2, src2, 8, stride, 8); | |
3936 | |
3937 s->dsp.diff_pixels(temp, lsrc1, lsrc2, 8); | |
1007 | 3938 |
1013 | 3939 s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); |
3940 | |
3941 bits=0; | |
2967 | 3942 |
1013 | 3943 if (s->mb_intra) { |
2967 | 3944 start_i = 1; |
1013 | 3945 length = s->intra_ac_vlc_length; |
3946 last_length= s->intra_ac_vlc_last_length; | |
3947 bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma | |
3948 } else { | |
3949 start_i = 0; | |
3950 length = s->inter_ac_vlc_length; | |
3951 last_length= s->inter_ac_vlc_last_length; | |
3952 } | |
2967 | 3953 |
1013 | 3954 if(last>=start_i){ |
1007 | 3955 run=0; |
3956 for(i=start_i; i<last; i++){ | |
3957 int j= scantable[i]; | |
3958 level= temp[j]; | |
2967 | 3959 |
1007 | 3960 if(level){ |
3961 level+=64; | |
3962 if((level&(~127)) == 0){ | |
3963 bits+= length[UNI_AC_ENC_INDEX(run, level)]; | |
3964 }else | |
3965 bits+= esc_length; | |
3966 run=0; | |
3967 }else | |
3968 run++; | |
3969 } | |
3970 i= scantable[last]; | |
2967 | 3971 |
1011 | 3972 level= temp[i] + 64; |
3973 | |
3974 assert(level - 64); | |
2967 | 3975 |
1007 | 3976 if((level&(~127)) == 0){ |
3977 bits+= last_length[UNI_AC_ENC_INDEX(run, level)]; | |
3978 }else | |
3979 bits+= esc_length; | |
2967 | 3980 |
1013 | 3981 } |
3982 | |
3983 if(last>=0){ | |
1689 | 3984 if(s->mb_intra) |
3985 s->dct_unquantize_intra(s, temp, 0, s->qscale); | |
3986 else | |
3987 s->dct_unquantize_inter(s, temp, 0, s->qscale); | |
1007 | 3988 } |
2967 | 3989 |
10068 | 3990 s->dsp.idct_add(lsrc2, 8, temp); |
3991 | |
3992 distortion= s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8); | |
6719 | 3993 |
3994 return distortion + ((bits*s->qscale*s->qscale*109 + 64)>>7); | |
1007 | 3995 } |
3996 | |
1708 | 3997 static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ |
1007 | 3998 MpegEncContext * const s= (MpegEncContext *)c; |
1064 | 3999 const uint8_t *scantable= s->intra_scantable.permutated; |
11195 | 4000 LOCAL_ALIGNED_16(DCTELEM, temp, [64]); |
1007 | 4001 int i, last, run, bits, level, start_i; |
4002 const int esc_length= s->ac_esc_length; | |
4003 uint8_t * length; | |
4004 uint8_t * last_length; | |
1708 | 4005 |
4006 assert(h==8); | |
2967 | 4007 |
1013 | 4008 s->dsp.diff_pixels(temp, src1, src2, stride); |
1007 | 4009 |
1013 | 4010 s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); |
4011 | |
4012 bits=0; | |
2967 | 4013 |
1007 | 4014 if (s->mb_intra) { |
2967 | 4015 start_i = 1; |
1007 | 4016 length = s->intra_ac_vlc_length; |
4017 last_length= s->intra_ac_vlc_last_length; | |
1013 | 4018 bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma |
1007 | 4019 } else { |
4020 start_i = 0; | |
4021 length = s->inter_ac_vlc_length; | |
4022 last_length= s->inter_ac_vlc_last_length; | |
4023 } | |
2967 | 4024 |
1013 | 4025 if(last>=start_i){ |
1007 | 4026 run=0; |
4027 for(i=start_i; i<last; i++){ | |
4028 int j= scantable[i]; | |
4029 level= temp[j]; | |
2967 | 4030 |
1007 | 4031 if(level){ |
4032 level+=64; | |
4033 if((level&(~127)) == 0){ | |
4034 bits+= length[UNI_AC_ENC_INDEX(run, level)]; | |
4035 }else | |
4036 bits+= esc_length; | |
4037 run=0; | |
4038 }else | |
4039 run++; | |
4040 } | |
4041 i= scantable[last]; | |
2967 | 4042 |
1013 | 4043 level= temp[i] + 64; |
2967 | 4044 |
1013 | 4045 assert(level - 64); |
2967 | 4046 |
1007 | 4047 if((level&(~127)) == 0){ |
4048 bits+= last_length[UNI_AC_ENC_INDEX(run, level)]; | |
4049 }else | |
4050 bits+= esc_length; | |
4051 } | |
4052 | |
4053 return bits; | |
4054 } | |
4055 | |
8978 | 4056 #define VSAD_INTRA(size) \ |
4057 static int vsad_intra##size##_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ \ | |
4058 int score=0; \ | |
4059 int x,y; \ | |
4060 \ | |
4061 for(y=1; y<h; y++){ \ | |
4062 for(x=0; x<size; x+=4){ \ | |
4063 score+= FFABS(s[x ] - s[x +stride]) + FFABS(s[x+1] - s[x+1+stride]) \ | |
4064 +FFABS(s[x+2] - s[x+2+stride]) + FFABS(s[x+3] - s[x+3+stride]); \ | |
4065 } \ | |
4066 s+= stride; \ | |
4067 } \ | |
4068 \ | |
4069 return score; \ | |
1729 | 4070 } |
8978 | 4071 VSAD_INTRA(8) |
4072 VSAD_INTRA(16) | |
1729 | 4073 |
4074 static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ | |
4075 int score=0; | |
4076 int x,y; | |
2967 | 4077 |
1729 | 4078 for(y=1; y<h; y++){ |
4079 for(x=0; x<16; x++){ | |
4001 | 4080 score+= FFABS(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]); |
1729 | 4081 } |
4082 s1+= stride; | |
4083 s2+= stride; | |
4084 } | |
2967 | 4085 |
1729 | 4086 return score; |
4087 } | |
4088 | |
4089 #define SQ(a) ((a)*(a)) | |
8978 | 4090 #define VSSE_INTRA(size) \ |
4091 static int vsse_intra##size##_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ \ | |
4092 int score=0; \ | |
4093 int x,y; \ | |
4094 \ | |
4095 for(y=1; y<h; y++){ \ | |
4096 for(x=0; x<size; x+=4){ \ | |
4097 score+= SQ(s[x ] - s[x +stride]) + SQ(s[x+1] - s[x+1+stride]) \ | |
4098 +SQ(s[x+2] - s[x+2+stride]) + SQ(s[x+3] - s[x+3+stride]); \ | |
4099 } \ | |
4100 s+= stride; \ | |
4101 } \ | |
4102 \ | |
4103 return score; \ | |
1729 | 4104 } |
8978 | 4105 VSSE_INTRA(8) |
4106 VSSE_INTRA(16) | |
1729 | 4107 |
4108 static int vsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ | |
4109 int score=0; | |
4110 int x,y; | |
2967 | 4111 |
1729 | 4112 for(y=1; y<h; y++){ |
4113 for(x=0; x<16; x++){ | |
4114 score+= SQ(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]); | |
4115 } | |
4116 s1+= stride; | |
4117 s2+= stride; | |
4118 } | |
2967 | 4119 |
1729 | 4120 return score; |
4121 } | |
4122 | |
5255 | 4123 static int ssd_int8_vs_int16_c(const int8_t *pix1, const int16_t *pix2, |
4124 int size){ | |
4749 | 4125 int score=0; |
4126 int i; | |
4127 for(i=0; i<size; i++) | |
4128 score += (pix1[i]-pix2[i])*(pix1[i]-pix2[i]); | |
4129 return score; | |
4130 } | |
4131 | |
6056
558c1fd0ee72
Fix typo in macro name: WARPER8_16_SQ --> WRAPPER8_16_SQ.
diego
parents:
6054
diff
changeset
|
4132 WRAPPER8_16_SQ(hadamard8_diff8x8_c, hadamard8_diff16_c) |
558c1fd0ee72
Fix typo in macro name: WARPER8_16_SQ --> WRAPPER8_16_SQ.
diego
parents:
6054
diff
changeset
|
4133 WRAPPER8_16_SQ(hadamard8_intra8x8_c, hadamard8_intra16_c) |
558c1fd0ee72
Fix typo in macro name: WARPER8_16_SQ --> WRAPPER8_16_SQ.
diego
parents:
6054
diff
changeset
|
4134 WRAPPER8_16_SQ(dct_sad8x8_c, dct_sad16_c) |
8590 | 4135 #if CONFIG_GPL |
6056
558c1fd0ee72
Fix typo in macro name: WARPER8_16_SQ --> WRAPPER8_16_SQ.
diego
parents:
6054
diff
changeset
|
4136 WRAPPER8_16_SQ(dct264_sad8x8_c, dct264_sad16_c) |
3013 | 4137 #endif |
6056
558c1fd0ee72
Fix typo in macro name: WARPER8_16_SQ --> WRAPPER8_16_SQ.
diego
parents:
6054
diff
changeset
|
4138 WRAPPER8_16_SQ(dct_max8x8_c, dct_max16_c) |
558c1fd0ee72
Fix typo in macro name: WARPER8_16_SQ --> WRAPPER8_16_SQ.
diego
parents:
6054
diff
changeset
|
4139 WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c) |
558c1fd0ee72
Fix typo in macro name: WARPER8_16_SQ --> WRAPPER8_16_SQ.
diego
parents:
6054
diff
changeset
|
4140 WRAPPER8_16_SQ(rd8x8_c, rd16_c) |
558c1fd0ee72
Fix typo in macro name: WARPER8_16_SQ --> WRAPPER8_16_SQ.
diego
parents:
6054
diff
changeset
|
4141 WRAPPER8_16_SQ(bit8x8_c, bit16_c) |
936 | 4142 |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4143 static void vector_fmul_c(float *dst, const float *src, int len){ |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4144 int i; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4145 for(i=0; i<len; i++) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4146 dst[i] *= src[i]; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4147 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4148 |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4149 static void vector_fmul_reverse_c(float *dst, const float *src0, const float *src1, int len){ |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4150 int i; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4151 src1 += len-1; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4152 for(i=0; i<len; i++) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4153 dst[i] = src0[i] * src1[-i]; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4154 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4155 |
10300
4d1b9ca628fc
Drop unused args from vector_fmul_add_add, simpify code, and rename
mru
parents:
10219
diff
changeset
|
4156 static void vector_fmul_add_c(float *dst, const float *src0, const float *src1, const float *src2, int len){ |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4157 int i; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4158 for(i=0; i<len; i++) |
10300
4d1b9ca628fc
Drop unused args from vector_fmul_add_add, simpify code, and rename
mru
parents:
10219
diff
changeset
|
4159 dst[i] = src0[i] * src1[i] + src2[i]; |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4160 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4161 |
7261 | 4162 void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len){ |
7263 | 4163 int i,j; |
4164 dst += len; | |
4165 win += len; | |
4166 src0+= len; | |
4167 for(i=-len, j=len-1; i<0; i++, j--) { | |
4168 float s0 = src0[i]; | |
4169 float s1 = src1[j]; | |
4170 float wi = win[i]; | |
4171 float wj = win[j]; | |
4172 dst[i] = s0*wj - s1*wi + add_bias; | |
4173 dst[j] = s0*wi + s1*wj + add_bias; | |
4174 } | |
7261 | 4175 } |
4176 | |
10219 | 4177 static void vector_fmul_scalar_c(float *dst, const float *src, float mul, |
4178 int len) | |
4179 { | |
4180 int i; | |
4181 for (i = 0; i < len; i++) | |
4182 dst[i] = src[i] * mul; | |
4183 } | |
4184 | |
4185 static void vector_fmul_sv_scalar_2_c(float *dst, const float *src, | |
4186 const float **sv, float mul, int len) | |
4187 { | |
4188 int i; | |
4189 for (i = 0; i < len; i += 2, sv++) { | |
4190 dst[i ] = src[i ] * sv[0][0] * mul; | |
4191 dst[i+1] = src[i+1] * sv[0][1] * mul; | |
4192 } | |
4193 } | |
4194 | |
4195 static void vector_fmul_sv_scalar_4_c(float *dst, const float *src, | |
4196 const float **sv, float mul, int len) | |
4197 { | |
4198 int i; | |
4199 for (i = 0; i < len; i += 4, sv++) { | |
4200 dst[i ] = src[i ] * sv[0][0] * mul; | |
4201 dst[i+1] = src[i+1] * sv[0][1] * mul; | |
4202 dst[i+2] = src[i+2] * sv[0][2] * mul; | |
4203 dst[i+3] = src[i+3] * sv[0][3] * mul; | |
4204 } | |
4205 } | |
4206 | |
4207 static void sv_fmul_scalar_2_c(float *dst, const float **sv, float mul, | |
4208 int len) | |
4209 { | |
4210 int i; | |
4211 for (i = 0; i < len; i += 2, sv++) { | |
4212 dst[i ] = sv[0][0] * mul; | |
4213 dst[i+1] = sv[0][1] * mul; | |
4214 } | |
4215 } | |
4216 | |
4217 static void sv_fmul_scalar_4_c(float *dst, const float **sv, float mul, | |
4218 int len) | |
4219 { | |
4220 int i; | |
4221 for (i = 0; i < len; i += 4, sv++) { | |
4222 dst[i ] = sv[0][0] * mul; | |
4223 dst[i+1] = sv[0][1] * mul; | |
4224 dst[i+2] = sv[0][2] * mul; | |
4225 dst[i+3] = sv[0][3] * mul; | |
4226 } | |
4227 } | |
4228 | |
4229 static void butterflies_float_c(float *restrict v1, float *restrict v2, | |
4230 int len) | |
4231 { | |
4232 int i; | |
4233 for (i = 0; i < len; i++) { | |
4234 float t = v1[i] - v2[i]; | |
4235 v1[i] += v2[i]; | |
4236 v2[i] = t; | |
4237 } | |
4238 } | |
4239 | |
4240 static float scalarproduct_float_c(const float *v1, const float *v2, int len) | |
4241 { | |
4242 float p = 0.0; | |
4243 int i; | |
4244 | |
4245 for (i = 0; i < len; i++) | |
4246 p += v1[i] * v2[i]; | |
4247 | |
4248 return p; | |
4249 } | |
4250 | |
7564 | 4251 static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){ |
4252 int i; | |
4253 for(i=0; i<len; i++) | |
4254 dst[i] = src[i] * mul; | |
4255 } | |
4256 | |
10104
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4257 static inline uint32_t clipf_c_one(uint32_t a, uint32_t mini, |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4258 uint32_t maxi, uint32_t maxisign) |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4259 { |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4260 |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4261 if(a > mini) return mini; |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4262 else if((a^(1<<31)) > maxisign) return maxi; |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4263 else return a; |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4264 } |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4265 |
10105 | 4266 static void vector_clipf_c_opposite_sign(float *dst, const float *src, float *min, float *max, int len){ |
10104
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4267 int i; |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4268 uint32_t mini = *(uint32_t*)min; |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4269 uint32_t maxi = *(uint32_t*)max; |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4270 uint32_t maxisign = maxi ^ (1<<31); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4271 uint32_t *dsti = (uint32_t*)dst; |
10105 | 4272 const uint32_t *srci = (const uint32_t*)src; |
10104
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4273 for(i=0; i<len; i+=8) { |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4274 dsti[i + 0] = clipf_c_one(srci[i + 0], mini, maxi, maxisign); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4275 dsti[i + 1] = clipf_c_one(srci[i + 1], mini, maxi, maxisign); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4276 dsti[i + 2] = clipf_c_one(srci[i + 2], mini, maxi, maxisign); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4277 dsti[i + 3] = clipf_c_one(srci[i + 3], mini, maxi, maxisign); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4278 dsti[i + 4] = clipf_c_one(srci[i + 4], mini, maxi, maxisign); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4279 dsti[i + 5] = clipf_c_one(srci[i + 5], mini, maxi, maxisign); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4280 dsti[i + 6] = clipf_c_one(srci[i + 6], mini, maxi, maxisign); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4281 dsti[i + 7] = clipf_c_one(srci[i + 7], mini, maxi, maxisign); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4282 } |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4283 } |
10105 | 4284 static void vector_clipf_c(float *dst, const float *src, float min, float max, int len){ |
10104
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4285 int i; |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4286 if(min < 0 && max > 0) { |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4287 vector_clipf_c_opposite_sign(dst, src, &min, &max, len); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4288 } else { |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4289 for(i=0; i < len; i+=8) { |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4290 dst[i ] = av_clipf(src[i ], min, max); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4291 dst[i + 1] = av_clipf(src[i + 1], min, max); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4292 dst[i + 2] = av_clipf(src[i + 2], min, max); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4293 dst[i + 3] = av_clipf(src[i + 3], min, max); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4294 dst[i + 4] = av_clipf(src[i + 4], min, max); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4295 dst[i + 5] = av_clipf(src[i + 5], min, max); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4296 dst[i + 6] = av_clipf(src[i + 6], min, max); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4297 dst[i + 7] = av_clipf(src[i + 7], min, max); |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4298 } |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4299 } |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4300 } |
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4301 |
7261 | 4302 static av_always_inline int float_to_int16_one(const float *src){ |
4303 int_fast32_t tmp = *(const int32_t*)src; | |
4304 if(tmp & 0xf0000){ | |
4305 tmp = (0x43c0ffff - tmp)>>31; | |
4306 // is this faster on some gcc/cpu combinations? | |
4307 // if(tmp > 0x43c0ffff) tmp = 0xFFFF; | |
4308 // else tmp = 0; | |
4309 } | |
4310 return tmp - 0x8000; | |
4311 } | |
4312 | |
7218 | 4313 void ff_float_to_int16_c(int16_t *dst, const float *src, long len){ |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4314 int i; |
7261 | 4315 for(i=0; i<len; i++) |
4316 dst[i] = float_to_int16_one(src+i); | |
4317 } | |
4318 | |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7263
diff
changeset
|
4319 void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, int channels){ |
7261 | 4320 int i,j,c; |
4321 if(channels==2){ | |
4322 for(i=0; i<len; i++){ | |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7263
diff
changeset
|
4323 dst[2*i] = float_to_int16_one(src[0]+i); |
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7263
diff
changeset
|
4324 dst[2*i+1] = float_to_int16_one(src[1]+i); |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4325 } |
7261 | 4326 }else{ |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7263
diff
changeset
|
4327 for(c=0; c<channels; c++) |
7261 | 4328 for(i=0, j=c; i<len; i++, j+=channels) |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7263
diff
changeset
|
4329 dst[j] = float_to_int16_one(src[c]+i); |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4330 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4331 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4332 |
7203
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4333 static int32_t scalarproduct_int16_c(int16_t * v1, int16_t * v2, int order, int shift) |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4334 { |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4335 int res = 0; |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4336 |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4337 while (order--) |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4338 res += (*v1++ * *v2++) >> shift; |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4339 |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4340 return res; |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4341 } |
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4342 |
10644 | 4343 static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul) |
4344 { | |
4345 int res = 0; | |
4346 while (order--) { | |
4347 res += *v1 * *v2++; | |
4348 *v1++ += mul * *v3++; | |
4349 } | |
4350 return res; | |
4351 } | |
4352 | |
5887 | 4353 #define W0 2048 |
4354 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ | |
4355 #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ | |
4356 #define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */ | |
4357 #define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */ | |
4358 #define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */ | |
4359 #define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */ | |
4360 #define W7 565 /* 2048*sqrt (2)*cos (7*pi/16) */ | |
4361 | |
4362 static void wmv2_idct_row(short * b) | |
4363 { | |
4364 int s1,s2; | |
4365 int a0,a1,a2,a3,a4,a5,a6,a7; | |
4366 /*step 1*/ | |
4367 a1 = W1*b[1]+W7*b[7]; | |
4368 a7 = W7*b[1]-W1*b[7]; | |
4369 a5 = W5*b[5]+W3*b[3]; | |
4370 a3 = W3*b[5]-W5*b[3]; | |
4371 a2 = W2*b[2]+W6*b[6]; | |
4372 a6 = W6*b[2]-W2*b[6]; | |
4373 a0 = W0*b[0]+W0*b[4]; | |
4374 a4 = W0*b[0]-W0*b[4]; | |
4375 /*step 2*/ | |
4376 s1 = (181*(a1-a5+a7-a3)+128)>>8;//1,3,5,7, | |
4377 s2 = (181*(a1-a5-a7+a3)+128)>>8; | |
4378 /*step 3*/ | |
4379 b[0] = (a0+a2+a1+a5 + (1<<7))>>8; | |
4380 b[1] = (a4+a6 +s1 + (1<<7))>>8; | |
4381 b[2] = (a4-a6 +s2 + (1<<7))>>8; | |
4382 b[3] = (a0-a2+a7+a3 + (1<<7))>>8; | |
4383 b[4] = (a0-a2-a7-a3 + (1<<7))>>8; | |
4384 b[5] = (a4-a6 -s2 + (1<<7))>>8; | |
4385 b[6] = (a4+a6 -s1 + (1<<7))>>8; | |
4386 b[7] = (a0+a2-a1-a5 + (1<<7))>>8; | |
4387 } | |
4388 static void wmv2_idct_col(short * b) | |
4389 { | |
4390 int s1,s2; | |
4391 int a0,a1,a2,a3,a4,a5,a6,a7; | |
4392 /*step 1, with extended precision*/ | |
4393 a1 = (W1*b[8*1]+W7*b[8*7] + 4)>>3; | |
4394 a7 = (W7*b[8*1]-W1*b[8*7] + 4)>>3; | |
4395 a5 = (W5*b[8*5]+W3*b[8*3] + 4)>>3; | |
4396 a3 = (W3*b[8*5]-W5*b[8*3] + 4)>>3; | |
4397 a2 = (W2*b[8*2]+W6*b[8*6] + 4)>>3; | |
4398 a6 = (W6*b[8*2]-W2*b[8*6] + 4)>>3; | |
4399 a0 = (W0*b[8*0]+W0*b[8*4] )>>3; | |
4400 a4 = (W0*b[8*0]-W0*b[8*4] )>>3; | |
4401 /*step 2*/ | |
4402 s1 = (181*(a1-a5+a7-a3)+128)>>8; | |
4403 s2 = (181*(a1-a5-a7+a3)+128)>>8; | |
4404 /*step 3*/ | |
4405 b[8*0] = (a0+a2+a1+a5 + (1<<13))>>14; | |
4406 b[8*1] = (a4+a6 +s1 + (1<<13))>>14; | |
4407 b[8*2] = (a4-a6 +s2 + (1<<13))>>14; | |
4408 b[8*3] = (a0-a2+a7+a3 + (1<<13))>>14; | |
4409 | |
4410 b[8*4] = (a0-a2-a7-a3 + (1<<13))>>14; | |
4411 b[8*5] = (a4-a6 -s2 + (1<<13))>>14; | |
4412 b[8*6] = (a4+a6 -s1 + (1<<13))>>14; | |
4413 b[8*7] = (a0+a2-a1-a5 + (1<<13))>>14; | |
4414 } | |
4415 void ff_wmv2_idct_c(short * block){ | |
4416 int i; | |
4417 | |
4418 for(i=0;i<64;i+=8){ | |
4419 wmv2_idct_row(block+i); | |
4420 } | |
4421 for(i=0;i<8;i++){ | |
4422 wmv2_idct_col(block+i); | |
4423 } | |
4424 } | |
1092 | 4425 /* XXX: those functions should be suppressed ASAP when all IDCTs are |
4426 converted */ | |
5887 | 4427 static void ff_wmv2_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block) |
4428 { | |
4429 ff_wmv2_idct_c(block); | |
4430 put_pixels_clamped_c(block, dest, line_size); | |
4431 } | |
4432 static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block) | |
4433 { | |
4434 ff_wmv2_idct_c(block); | |
4435 add_pixels_clamped_c(block, dest, line_size); | |
4436 } | |
1092 | 4437 static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block) |
4438 { | |
4439 j_rev_dct (block); | |
4440 put_pixels_clamped_c(block, dest, line_size); | |
4441 } | |
4442 static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block) | |
4443 { | |
4444 j_rev_dct (block); | |
4445 add_pixels_clamped_c(block, dest, line_size); | |
4446 } | |
4447 | |
2256 | 4448 static void ff_jref_idct4_put(uint8_t *dest, int line_size, DCTELEM *block) |
4449 { | |
4450 j_rev_dct4 (block); | |
4451 put_pixels_clamped4_c(block, dest, line_size); | |
4452 } | |
4453 static void ff_jref_idct4_add(uint8_t *dest, int line_size, DCTELEM *block) | |
4454 { | |
4455 j_rev_dct4 (block); | |
4456 add_pixels_clamped4_c(block, dest, line_size); | |
4457 } | |
4458 | |
2257 | 4459 static void ff_jref_idct2_put(uint8_t *dest, int line_size, DCTELEM *block) |
4460 { | |
4461 j_rev_dct2 (block); | |
4462 put_pixels_clamped2_c(block, dest, line_size); | |
4463 } | |
4464 static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block) | |
4465 { | |
4466 j_rev_dct2 (block); | |
4467 add_pixels_clamped2_c(block, dest, line_size); | |
4468 } | |
4469 | |
2259 | 4470 static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block) |
4471 { | |
4176 | 4472 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
2259 | 4473 |
4474 dest[0] = cm[(block[0] + 4)>>3]; | |
4475 } | |
4476 static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block) | |
4477 { | |
4176 | 4478 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
2259 | 4479 |
4480 dest[0] = cm[dest[0] + ((block[0] + 4)>>3)]; | |
4481 } | |
4482 | |
5143 | 4483 static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; } |
3215
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3199
diff
changeset
|
4484 |
1201 | 4485 /* init static data */ |
10867 | 4486 av_cold void dsputil_static_init(void) |
0 | 4487 { |
751 | 4488 int i; |
0 | 4489 |
4176 | 4490 for(i=0;i<256;i++) ff_cropTbl[i + MAX_NEG_CROP] = i; |
1201 | 4491 for(i=0;i<MAX_NEG_CROP;i++) { |
4176 | 4492 ff_cropTbl[i] = 0; |
4493 ff_cropTbl[i + MAX_NEG_CROP + 256] = 255; | |
1201 | 4494 } |
2967 | 4495 |
1201 | 4496 for(i=0;i<512;i++) { |
4179 | 4497 ff_squareTbl[i] = (i - 256) * (i - 256); |
1201 | 4498 } |
2967 | 4499 |
4197 | 4500 for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1; |
1201 | 4501 } |
0 | 4502 |
4281
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4503 int ff_check_alignment(void){ |
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4504 static int did_fail=0; |
11369 | 4505 DECLARE_ALIGNED(16, int, aligned); |
4281
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4506 |
9259 | 4507 if((intptr_t)&aligned & 15){ |
4281
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4508 if(!did_fail){ |
8590 | 4509 #if HAVE_MMX || HAVE_ALTIVEC |
4281
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4510 av_log(NULL, AV_LOG_ERROR, |
4292 | 4511 "Compiler did not align stack variables. Libavcodec has been miscompiled\n" |
4512 "and may be very slow or crash. This is not a bug in libavcodec,\n" | |
5542
b0a566346fb1
Add attribute that forces alignment of stack to functions that need it.
ramiro
parents:
5520
diff
changeset
|
4513 "but in the compiler. You may try recompiling using gcc >= 4.2.\n" |
b0a566346fb1
Add attribute that forces alignment of stack to functions that need it.
ramiro
parents:
5520
diff
changeset
|
4514 "Do not report crashes to FFmpeg developers.\n"); |
4281
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4515 #endif |
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4516 did_fail=1; |
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4517 } |
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4518 return -1; |
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4519 } |
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4520 return 0; |
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4521 } |
861 | 4522 |
10867 | 4523 av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) |
1201 | 4524 { |
4525 int i; | |
0 | 4526 |
4281
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4527 ff_check_alignment(); |
de525a2b41db
ff_check_alignment to warn the user about a missaligned stack
michael
parents:
4240
diff
changeset
|
4528 |
8590 | 4529 #if CONFIG_ENCODERS |
1567 | 4530 if(avctx->dct_algo==FF_DCT_FASTINT) { |
1092 | 4531 c->fdct = fdct_ifast; |
2979 | 4532 c->fdct248 = fdct_ifast248; |
2967 | 4533 } |
1567 | 4534 else if(avctx->dct_algo==FF_DCT_FAAN) { |
1557 | 4535 c->fdct = ff_faandct; |
2979 | 4536 c->fdct248 = ff_faandct248; |
2967 | 4537 } |
1567 | 4538 else { |
1092 | 4539 c->fdct = ff_jpeg_fdct_islow; //slow/accurate/default |
2979 | 4540 c->fdct248 = ff_fdct248_islow; |
1567 | 4541 } |
1092 | 4542 #endif //CONFIG_ENCODERS |
4543 | |
2256 | 4544 if(avctx->lowres==1){ |
8596
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4545 if(avctx->idct_algo==FF_IDCT_INT || avctx->idct_algo==FF_IDCT_AUTO || !CONFIG_H264_DECODER){ |
2272
cd43603c46f9
move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
2259
diff
changeset
|
4546 c->idct_put= ff_jref_idct4_put; |
cd43603c46f9
move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
2259
diff
changeset
|
4547 c->idct_add= ff_jref_idct4_add; |
cd43603c46f9
move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
2259
diff
changeset
|
4548 }else{ |
cd43603c46f9
move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
2259
diff
changeset
|
4549 c->idct_put= ff_h264_lowres_idct_put_c; |
cd43603c46f9
move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
2259
diff
changeset
|
4550 c->idct_add= ff_h264_lowres_idct_add_c; |
cd43603c46f9
move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
2259
diff
changeset
|
4551 } |
2256 | 4552 c->idct = j_rev_dct4; |
1092 | 4553 c->idct_permutation_type= FF_NO_IDCT_PERM; |
2257 | 4554 }else if(avctx->lowres==2){ |
4555 c->idct_put= ff_jref_idct2_put; | |
4556 c->idct_add= ff_jref_idct2_add; | |
4557 c->idct = j_rev_dct2; | |
4558 c->idct_permutation_type= FF_NO_IDCT_PERM; | |
2259 | 4559 }else if(avctx->lowres==3){ |
4560 c->idct_put= ff_jref_idct1_put; | |
4561 c->idct_add= ff_jref_idct1_add; | |
4562 c->idct = j_rev_dct1; | |
4563 c->idct_permutation_type= FF_NO_IDCT_PERM; | |
2256 | 4564 }else{ |
4565 if(avctx->idct_algo==FF_IDCT_INT){ | |
4566 c->idct_put= ff_jref_idct_put; | |
4567 c->idct_add= ff_jref_idct_add; | |
4568 c->idct = j_rev_dct; | |
4569 c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; | |
9975
d6d7e8d4a04d
Do not redundantly check for both CONFIG_THEORA_DECODER and CONFIG_VP3_DECODER.
diego
parents:
9586
diff
changeset
|
4570 }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) && |
5007 | 4571 avctx->idct_algo==FF_IDCT_VP3){ |
2693 | 4572 c->idct_put= ff_vp3_idct_put_c; |
4573 c->idct_add= ff_vp3_idct_add_c; | |
4574 c->idct = ff_vp3_idct_c; | |
4575 c->idct_permutation_type= FF_NO_IDCT_PERM; | |
5887 | 4576 }else if(avctx->idct_algo==FF_IDCT_WMV2){ |
4577 c->idct_put= ff_wmv2_idct_put_c; | |
4578 c->idct_add= ff_wmv2_idct_add_c; | |
4579 c->idct = ff_wmv2_idct_c; | |
4580 c->idct_permutation_type= FF_NO_IDCT_PERM; | |
6407 | 4581 }else if(avctx->idct_algo==FF_IDCT_FAAN){ |
4582 c->idct_put= ff_faanidct_put; | |
4583 c->idct_add= ff_faanidct_add; | |
4584 c->idct = ff_faanidct; | |
4585 c->idct_permutation_type= FF_NO_IDCT_PERM; | |
8596
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4586 }else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) { |
8120 | 4587 c->idct_put= ff_ea_idct_put_c; |
4588 c->idct_permutation_type= FF_NO_IDCT_PERM; | |
11231 | 4589 }else if(CONFIG_BINK_DECODER && avctx->idct_algo==FF_IDCT_BINK) { |
4590 c->idct = ff_bink_idct_c; | |
4591 c->idct_add = ff_bink_idct_add_c; | |
4592 c->idct_put = ff_bink_idct_put_c; | |
4593 c->idct_permutation_type = FF_NO_IDCT_PERM; | |
2256 | 4594 }else{ //accurate/default |
6001 | 4595 c->idct_put= ff_simple_idct_put; |
4596 c->idct_add= ff_simple_idct_add; | |
4597 c->idct = ff_simple_idct; | |
2256 | 4598 c->idct_permutation_type= FF_NO_IDCT_PERM; |
4599 } | |
1092 | 4600 } |
4601 | |
8596
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4602 if (CONFIG_H264_DECODER) { |
5065 | 4603 c->h264_idct_add= ff_h264_idct_add_c; |
4604 c->h264_idct8_add= ff_h264_idct8_add_c; | |
4605 c->h264_idct_dc_add= ff_h264_idct_dc_add_c; | |
4606 c->h264_idct8_dc_add= ff_h264_idct8_dc_add_c; | |
8375
de2509cf3c44
H.264 idct functions that include the chroma, inter luma and intra16 luma loops
michael
parents:
8359
diff
changeset
|
4607 c->h264_idct_add16 = ff_h264_idct_add16_c; |
de2509cf3c44
H.264 idct functions that include the chroma, inter luma and intra16 luma loops
michael
parents:
8359
diff
changeset
|
4608 c->h264_idct8_add4 = ff_h264_idct8_add4_c; |
de2509cf3c44
H.264 idct functions that include the chroma, inter luma and intra16 luma loops
michael
parents:
8359
diff
changeset
|
4609 c->h264_idct_add8 = ff_h264_idct_add8_c; |
de2509cf3c44
H.264 idct functions that include the chroma, inter luma and intra16 luma loops
michael
parents:
8359
diff
changeset
|
4610 c->h264_idct_add16intra= ff_h264_idct_add16intra_c; |
5064 | 4611 } |
2272
cd43603c46f9
move h264 idct to its own file and call via function pointer in DspContext
michael
parents:
2259
diff
changeset
|
4612 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4613 c->get_pixels = get_pixels_c; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4614 c->diff_pixels = diff_pixels_c; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4615 c->put_pixels_clamped = put_pixels_clamped_c; |
1984
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
4616 c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; |
11231 | 4617 c->put_pixels_nonclamped = put_pixels_nonclamped_c; |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4618 c->add_pixels_clamped = add_pixels_clamped_c; |
2763 | 4619 c->add_pixels8 = add_pixels8_c; |
4620 c->add_pixels4 = add_pixels4_c; | |
4988
689490842cf5
factor sum_abs_dctelem out of dct_sad, and simd it.
lorenm
parents:
4749
diff
changeset
|
4621 c->sum_abs_dctelem = sum_abs_dctelem_c; |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4622 c->gmc1 = gmc1_c; |
3248
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3245
diff
changeset
|
4623 c->gmc = ff_gmc_c; |
8288 | 4624 c->clear_block = clear_block_c; |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4625 c->clear_blocks = clear_blocks_c; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4626 c->pix_sum = pix_sum_c; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4627 c->pix_norm1 = pix_norm1_c; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4628 |
11231 | 4629 c->fill_block_tab[0] = fill_block16_c; |
4630 c->fill_block_tab[1] = fill_block8_c; | |
4631 c->scale_block = scale_block_c; | |
4632 | |
859 | 4633 /* TODO [0] 16 [1] 8 */ |
1708 | 4634 c->pix_abs[0][0] = pix_abs16_c; |
4635 c->pix_abs[0][1] = pix_abs16_x2_c; | |
4636 c->pix_abs[0][2] = pix_abs16_y2_c; | |
4637 c->pix_abs[0][3] = pix_abs16_xy2_c; | |
4638 c->pix_abs[1][0] = pix_abs8_c; | |
4639 c->pix_abs[1][1] = pix_abs8_x2_c; | |
4640 c->pix_abs[1][2] = pix_abs8_y2_c; | |
4641 c->pix_abs[1][3] = pix_abs8_xy2_c; | |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4642 |
859 | 4643 #define dspfunc(PFX, IDX, NUM) \ |
4644 c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## NUM ## _c; \ | |
4645 c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## NUM ## _x2_c; \ | |
4646 c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## NUM ## _y2_c; \ | |
4647 c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## NUM ## _xy2_c | |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
764
diff
changeset
|
4648 |
859 | 4649 dspfunc(put, 0, 16); |
4650 dspfunc(put_no_rnd, 0, 16); | |
4651 dspfunc(put, 1, 8); | |
4652 dspfunc(put_no_rnd, 1, 8); | |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4653 dspfunc(put, 2, 4); |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4654 dspfunc(put, 3, 2); |
0 | 4655 |
859 | 4656 dspfunc(avg, 0, 16); |
4657 dspfunc(avg_no_rnd, 0, 16); | |
4658 dspfunc(avg, 1, 8); | |
4659 dspfunc(avg_no_rnd, 1, 8); | |
1319 | 4660 dspfunc(avg, 2, 4); |
4661 dspfunc(avg, 3, 2); | |
859 | 4662 #undef dspfunc |
857 | 4663 |
1864 | 4664 c->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c; |
4665 c->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c; | |
4666 | |
1267
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4667 c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4668 c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4669 c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4670 c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4671 c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4672 c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4673 c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4674 c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4675 c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c; |
85b71f9f7450
moving the svq3 motion compensation stuff to dsputil (this also means that existing optimized halfpel code is used now ...)
michaelni
parents:
1264
diff
changeset
|
4676 |
1319 | 4677 c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c; |
4678 c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c; | |
4679 c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c; | |
4680 c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c; | |
4681 c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c; | |
4682 c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c; | |
4683 c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c; | |
4684 c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c; | |
4685 c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c; | |
4686 | |
859 | 4687 #define dspfunc(PFX, IDX, NUM) \ |
4688 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \ | |
4689 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \ | |
4690 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \ | |
4691 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \ | |
4692 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \ | |
4693 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \ | |
4694 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \ | |
4695 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \ | |
4696 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \ | |
4697 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \ | |
4698 c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \ | |
4699 c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \ | |
4700 c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \ | |
4701 c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \ | |
4702 c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \ | |
4703 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c | |
857 | 4704 |
859 | 4705 dspfunc(put_qpel, 0, 16); |
4706 dspfunc(put_no_rnd_qpel, 0, 16); | |
4707 | |
4708 dspfunc(avg_qpel, 0, 16); | |
4709 /* dspfunc(avg_no_rnd_qpel, 0, 16); */ | |
857 | 4710 |
859 | 4711 dspfunc(put_qpel, 1, 8); |
4712 dspfunc(put_no_rnd_qpel, 1, 8); | |
4713 | |
4714 dspfunc(avg_qpel, 1, 8); | |
4715 /* dspfunc(avg_no_rnd_qpel, 1, 8); */ | |
1168 | 4716 |
4717 dspfunc(put_h264_qpel, 0, 16); | |
4718 dspfunc(put_h264_qpel, 1, 8); | |
4719 dspfunc(put_h264_qpel, 2, 4); | |
3020
c75fb0747e74
use h264 MC functions for 2xX Xx2 blocks in snow too
michael
parents:
3013
diff
changeset
|
4720 dspfunc(put_h264_qpel, 3, 2); |
1168 | 4721 dspfunc(avg_h264_qpel, 0, 16); |
4722 dspfunc(avg_h264_qpel, 1, 8); | |
4723 dspfunc(avg_h264_qpel, 2, 4); | |
4724 | |
859 | 4725 #undef dspfunc |
1168 | 4726 c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c; |
4727 c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c; | |
4728 c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c; | |
4729 c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c; | |
4730 c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c; | |
4731 c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c; | |
9439
ef3a7b711cc0
Rename put_no_rnd_h264_chroma* to reflect its usage in VC1 only
conrad
parents:
9437
diff
changeset
|
4732 c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c; |
9440 | 4733 c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c; |
857 | 4734 |
2415 | 4735 c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c; |
4736 c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c; | |
4737 c->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c; | |
4738 c->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c; | |
4739 c->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c; | |
4740 c->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c; | |
4741 c->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c; | |
4742 c->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c; | |
4743 c->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c; | |
4744 c->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c; | |
4745 c->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c; | |
4746 c->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c; | |
4747 c->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c; | |
4748 c->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c; | |
4749 c->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c; | |
4750 c->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c; | |
4751 c->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c; | |
4752 c->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c; | |
4753 c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c; | |
4754 c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c; | |
4755 | |
6437 | 4756 c->draw_edges = draw_edges_c; |
4757 | |
8590 | 4758 #if CONFIG_CAVS_DECODER |
3395
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
4759 ff_cavsdsp_init(c,avctx); |
3432 | 4760 #endif |
9585 | 4761 |
4762 #if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER | |
4763 ff_mlp_init(c, avctx); | |
4764 #endif | |
9995
3141f69e3905
Do not check for both CONFIG_VC1_DECODER and CONFIG_WMV3_DECODER,
diego
parents:
9975
diff
changeset
|
4765 #if CONFIG_VC1_DECODER |
3526 | 4766 ff_vc1dsp_init(c,avctx); |
4767 #endif | |
9995
3141f69e3905
Do not check for both CONFIG_VC1_DECODER and CONFIG_WMV3_DECODER,
diego
parents:
9975
diff
changeset
|
4768 #if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER |
5887 | 4769 ff_intrax8dsp_init(c,avctx); |
4770 #endif | |
8590 | 4771 #if CONFIG_RV30_DECODER |
8410 | 4772 ff_rv30dsp_init(c,avctx); |
4773 #endif | |
8590 | 4774 #if CONFIG_RV40_DECODER |
8232 | 4775 ff_rv40dsp_init(c,avctx); |
4776 c->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c; | |
4777 c->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c; | |
4778 c->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c; | |
4779 c->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c; | |
4780 #endif | |
3395
adccbf4a1040
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
michael
parents:
3373
diff
changeset
|
4781 |
936 | 4782 c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c; |
4783 c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; | |
4784 c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c; | |
4785 c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c; | |
4786 c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c; | |
4787 c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c; | |
4788 c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c; | |
4789 c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c; | |
2967 | 4790 |
1708 | 4791 #define SET_CMP_FUNC(name) \ |
4792 c->name[0]= name ## 16_c;\ | |
4793 c->name[1]= name ## 8x8_c; | |
2967 | 4794 |
1708 | 4795 SET_CMP_FUNC(hadamard8_diff) |
1729 | 4796 c->hadamard8_diff[4]= hadamard8_intra16_c; |
8978 | 4797 c->hadamard8_diff[5]= hadamard8_intra8x8_c; |
1708 | 4798 SET_CMP_FUNC(dct_sad) |
2382 | 4799 SET_CMP_FUNC(dct_max) |
8590 | 4800 #if CONFIG_GPL |
3010
533c6386eca9
8x8 integer dct from x264 as cmp function (under CONFIG_GPL)
michael
parents:
2979
diff
changeset
|
4801 SET_CMP_FUNC(dct264_sad) |
3013 | 4802 #endif |
1708 | 4803 c->sad[0]= pix_abs16_c; |
4804 c->sad[1]= pix_abs8_c; | |
4805 c->sse[0]= sse16_c; | |
4806 c->sse[1]= sse8_c; | |
2184 | 4807 c->sse[2]= sse4_c; |
1708 | 4808 SET_CMP_FUNC(quant_psnr) |
4809 SET_CMP_FUNC(rd) | |
4810 SET_CMP_FUNC(bit) | |
1729 | 4811 c->vsad[0]= vsad16_c; |
4812 c->vsad[4]= vsad_intra16_c; | |
8978 | 4813 c->vsad[5]= vsad_intra8_c; |
1729 | 4814 c->vsse[0]= vsse16_c; |
4815 c->vsse[4]= vsse_intra16_c; | |
8978 | 4816 c->vsse[5]= vsse_intra8_c; |
2065
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
4817 c->nsse[0]= nsse16_c; |
9e4bebc39ade
noise preserving sum of squares comparission function
michael
parents:
2045
diff
changeset
|
4818 c->nsse[1]= nsse8_c; |
8590 | 4819 #if CONFIG_SNOW_ENCODER |
2184 | 4820 c->w53[0]= w53_16_c; |
4821 c->w53[1]= w53_8_c; | |
4822 c->w97[0]= w97_16_c; | |
4823 c->w97[1]= w97_8_c; | |
3373
b8996cc5ccae
Disable w53 and w97 cmp methods when snow encoder is disabled
gpoirier
parents:
3323
diff
changeset
|
4824 #endif |
2184 | 4825 |
4749 | 4826 c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c; |
4827 | |
866 | 4828 c->add_bytes= add_bytes_c; |
6384 | 4829 c->add_bytes_l2= add_bytes_l2_c; |
866 | 4830 c->diff_bytes= diff_bytes_c; |
8760 | 4831 c->add_hfyu_median_prediction= add_hfyu_median_prediction_c; |
1527 | 4832 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; |
10370 | 4833 c->add_hfyu_left_prediction = add_hfyu_left_prediction_c; |
4834 c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c; | |
1273 | 4835 c->bswap_buf= bswap_buf; |
8590 | 4836 #if CONFIG_PNG_DECODER |
6384 | 4837 c->add_png_paeth_prediction= ff_add_png_paeth_prediction; |
4838 #endif | |
2633 | 4839 |
4840 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c; | |
4841 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c; | |
8395
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
4842 c->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c; |
195cba8f6257
Move filter_luma_intra into dsputil for later addition of asm.
darkshikari
parents:
8375
diff
changeset
|
4843 c->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c; |
2633 | 4844 c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c; |
4845 c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c; | |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
4846 c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c; |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
4847 c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c; |
3645
47821be55b6c
mmx implementation of deblocking strength decision.
lorenm
parents:
3568
diff
changeset
|
4848 c->h264_loop_filter_strength= NULL; |
2967 | 4849 |
10749
5cca4b6c459d
Get rid of pointless CONFIG_ANY_H263 preprocessor definition.
diego
parents:
10748
diff
changeset
|
4850 if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { |
5278 | 4851 c->h263_h_loop_filter= h263_h_loop_filter_c; |
4852 c->h263_v_loop_filter= h263_v_loop_filter_c; | |
5277
7b3fcb7c61ce
Avoid linking with h263.c functions when the relevant codecs
aurel
parents:
5256
diff
changeset
|
4853 } |
2967 | 4854 |
9975
d6d7e8d4a04d
Do not redundantly check for both CONFIG_THEORA_DECODER and CONFIG_VP3_DECODER.
diego
parents:
9586
diff
changeset
|
4855 if (CONFIG_VP3_DECODER) { |
7995 | 4856 c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c; |
4857 c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c; | |
4858 } | |
8785
bee83b3f9a6b
move vp6_filter_diag4() to a new vp6dsp.c file and use it throught dsputil
aurel
parents:
8760
diff
changeset
|
4859 if (CONFIG_VP6_DECODER) { |
bee83b3f9a6b
move vp6_filter_diag4() to a new vp6dsp.c file and use it throught dsputil
aurel
parents:
8760
diff
changeset
|
4860 c->vp6_filter_diag4= ff_vp6_filter_diag4_c; |
bee83b3f9a6b
move vp6_filter_diag4() to a new vp6dsp.c file and use it throught dsputil
aurel
parents:
8760
diff
changeset
|
4861 } |
7995 | 4862 |
2045 | 4863 c->h261_loop_filter= h261_loop_filter_c; |
2967 | 4864 |
1784 | 4865 c->try_8x8basis= try_8x8basis_c; |
4866 c->add_8x8basis= add_8x8basis_c; | |
866 | 4867 |
8590 | 4868 #if CONFIG_SNOW_DECODER |
3198
6b9f0c4fbdbe
First part of a series of speed-enchancing patches.
gpoirier
parents:
3105
diff
changeset
|
4869 c->vertical_compose97i = ff_snow_vertical_compose97i; |
6b9f0c4fbdbe
First part of a series of speed-enchancing patches.
gpoirier
parents:
3105
diff
changeset
|
4870 c->horizontal_compose97i = ff_snow_horizontal_compose97i; |
6b9f0c4fbdbe
First part of a series of speed-enchancing patches.
gpoirier
parents:
3105
diff
changeset
|
4871 c->inner_add_yblock = ff_snow_inner_add_yblock; |
3199
1651e69b9f7a
10l: Only set *compose97i *add_yblock to dsputils context if we are building with Snow enabled
gpoirier
parents:
3198
diff
changeset
|
4872 #endif |
3198
6b9f0c4fbdbe
First part of a series of speed-enchancing patches.
gpoirier
parents:
3105
diff
changeset
|
4873 |
8590 | 4874 #if CONFIG_VORBIS_DECODER |
3536
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3526
diff
changeset
|
4875 c->vorbis_inverse_coupling = vorbis_inverse_coupling; |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3526
diff
changeset
|
4876 #endif |
8590 | 4877 #if CONFIG_AC3_DECODER |
7563 | 4878 c->ac3_downmix = ff_ac3_downmix_c; |
4879 #endif | |
10429
289dd8daf4ee
add CONFIG_LPC to the build system for lpc dsputil functions. fixes build
jbr
parents:
10424
diff
changeset
|
4880 #if CONFIG_LPC |
10424
94595d0e617c
Move autocorrelation function from flacenc.c to lpc.c. Also rename the
jbr
parents:
10421
diff
changeset
|
4881 c->lpc_compute_autocorr = ff_lpc_compute_autocorr; |
10429
289dd8daf4ee
add CONFIG_LPC to the build system for lpc dsputil functions. fixes build
jbr
parents:
10424
diff
changeset
|
4882 #endif |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4883 c->vector_fmul = vector_fmul_c; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4884 c->vector_fmul_reverse = vector_fmul_reverse_c; |
10300
4d1b9ca628fc
Drop unused args from vector_fmul_add_add, simpify code, and rename
mru
parents:
10219
diff
changeset
|
4885 c->vector_fmul_add = vector_fmul_add_c; |
7261 | 4886 c->vector_fmul_window = ff_vector_fmul_window_c; |
7564 | 4887 c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; |
10104
0fa3d21b317e
SSE optimized vector_clipf(). 10% faster TwinVQ decoding.
vitor
parents:
10094
diff
changeset
|
4888 c->vector_clipf = vector_clipf_c; |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3536
diff
changeset
|
4889 c->float_to_int16 = ff_float_to_int16_c; |
7261 | 4890 c->float_to_int16_interleave = ff_float_to_int16_interleave_c; |
7203
87b1dfb5a98d
Add several vector functions used by Monkey's Audio decoder to dsputil
kostya
parents:
6719
diff
changeset
|
4891 c->scalarproduct_int16 = scalarproduct_int16_c; |
10644 | 4892 c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; |
10219 | 4893 c->scalarproduct_float = scalarproduct_float_c; |
4894 c->butterflies_float = butterflies_float_c; | |
4895 c->vector_fmul_scalar = vector_fmul_scalar_c; | |
4896 | |
4897 c->vector_fmul_sv_scalar[0] = vector_fmul_sv_scalar_2_c; | |
4898 c->vector_fmul_sv_scalar[1] = vector_fmul_sv_scalar_4_c; | |
4899 | |
4900 c->sv_fmul_scalar[0] = sv_fmul_scalar_2_c; | |
4901 c->sv_fmul_scalar[1] = sv_fmul_scalar_4_c; | |
3536
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3526
diff
changeset
|
4902 |
3245 | 4903 c->shrink[0]= ff_img_copy_plane; |
4904 c->shrink[1]= ff_shrink22; | |
4905 c->shrink[2]= ff_shrink44; | |
4906 c->shrink[3]= ff_shrink88; | |
4907 | |
3215
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3199
diff
changeset
|
4908 c->prefetch= just_return; |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3199
diff
changeset
|
4909 |
3807
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4910 memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab)); |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4911 memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab)); |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4912 |
8596
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4913 if (HAVE_MMX) dsputil_init_mmx (c, avctx); |
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4914 if (ARCH_ARM) dsputil_init_arm (c, avctx); |
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4915 if (CONFIG_MLIB) dsputil_init_mlib (c, avctx); |
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4916 if (HAVE_VIS) dsputil_init_vis (c, avctx); |
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4917 if (ARCH_ALPHA) dsputil_init_alpha (c, avctx); |
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4918 if (ARCH_PPC) dsputil_init_ppc (c, avctx); |
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4919 if (HAVE_MMI) dsputil_init_mmi (c, avctx); |
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4920 if (ARCH_SH4) dsputil_init_sh4 (c, avctx); |
68e959302527
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
aurel
parents:
8590
diff
changeset
|
4921 if (ARCH_BFIN) dsputil_init_bfin (c, avctx); |
1092 | 4922 |
3807
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4923 for(i=0; i<64; i++){ |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4924 if(!c->put_2tap_qpel_pixels_tab[0][i]) |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4925 c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i]; |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4926 if(!c->avg_2tap_qpel_pixels_tab[0][i]) |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4927 c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i]; |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4928 } |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3728
diff
changeset
|
4929 |
1092 | 4930 switch(c->idct_permutation_type){ |
4931 case FF_NO_IDCT_PERM: | |
4932 for(i=0; i<64; i++) | |
4933 c->idct_permutation[i]= i; | |
4934 break; | |
4935 case FF_LIBMPEG2_IDCT_PERM: | |
4936 for(i=0; i<64; i++) | |
4937 c->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2); | |
4938 break; | |
4939 case FF_SIMPLE_IDCT_PERM: | |
4940 for(i=0; i<64; i++) | |
4941 c->idct_permutation[i]= simple_mmx_permutation[i]; | |
4942 break; | |
4943 case FF_TRANSPOSE_IDCT_PERM: | |
4944 for(i=0; i<64; i++) | |
4945 c->idct_permutation[i]= ((i&7)<<3) | (i>>3); | |
4946 break; | |
2696
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2693
diff
changeset
|
4947 case FF_PARTTRANS_IDCT_PERM: |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2693
diff
changeset
|
4948 for(i=0; i<64; i++) |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2693
diff
changeset
|
4949 c->idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2693
diff
changeset
|
4950 break; |
6600
c3213c91124c
Add a new IDCT permutation, used in xvid_sse2 and possibly future similar IDCTs.
astrange
parents:
6450
diff
changeset
|
4951 case FF_SSE2_IDCT_PERM: |
c3213c91124c
Add a new IDCT permutation, used in xvid_sse2 and possibly future similar IDCTs.
astrange
parents:
6450
diff
changeset
|
4952 for(i=0; i<64; i++) |
c3213c91124c
Add a new IDCT permutation, used in xvid_sse2 and possibly future similar IDCTs.
astrange
parents:
6450
diff
changeset
|
4953 c->idct_permutation[i]= (i&0x38) | idct_sse2_row_perm[i&7]; |
c3213c91124c
Add a new IDCT permutation, used in xvid_sse2 and possibly future similar IDCTs.
astrange
parents:
6450
diff
changeset
|
4954 break; |
1092 | 4955 default: |
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1571
diff
changeset
|
4956 av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n"); |
1092 | 4957 } |
0 | 4958 } |
252
ddb1a0e94cf4
- Added PSNR feature to libavcodec and ffmpeg. By now just Y PSNR until I'm
pulento
parents:
220
diff
changeset
|
4959 |