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