Mercurial > libavcodec.hg
annotate vc1dsp.c @ 6014:33b0514769b2 libavcodec
Fix non_zero_count_cache for deblocking in field pictures.
Based on original patch by Martin Zlomek martin.zlomek a email D cz
ffmpeg-devel thread: H264: Fix non_zero_count_cache for deblocking in fields
Fri, 30 Nov 2007 9:58:23
author | heydowns |
---|---|
date | Thu, 13 Dec 2007 00:50:47 +0000 |
parents | 90de28dfd8d6 |
children | 953c8efd5298 |
rev | line source |
---|---|
3526 | 1 /* |
2 * VC-1 and WMV3 decoder - DSP functions | |
3 * Copyright (c) 2006 Konstantin Shishkov | |
4 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3665
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3665
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3665
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
3526 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3665
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
3526 | 11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3665
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
3526 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3665
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3526 | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 */ | |
21 | |
22 /** | |
23 * @file vc1dsp.c | |
24 * VC-1 and WMV3 decoder | |
25 * | |
26 */ | |
27 | |
28 #include "dsputil.h" | |
29 | |
30 | |
4210 | 31 /** Apply overlap transform to horizontal edge |
3526 | 32 */ |
4239 | 33 static void vc1_v_overlap_c(uint8_t* src, int stride) |
3526 | 34 { |
35 int i; | |
36 int a, b, c, d; | |
4211 | 37 int d1, d2; |
4239 | 38 int rnd = 1; |
3526 | 39 for(i = 0; i < 8; i++) { |
40 a = src[-2*stride]; | |
41 b = src[-stride]; | |
42 c = src[0]; | |
43 d = src[stride]; | |
4211 | 44 d1 = (a - d + 3 + rnd) >> 3; |
45 d2 = (a - d + b - c + 4 - rnd) >> 3; | |
3526 | 46 |
4211 | 47 src[-2*stride] = a - d1; |
48 src[-stride] = b - d2; | |
49 src[0] = c + d2; | |
50 src[stride] = d + d1; | |
3526 | 51 src++; |
4239 | 52 rnd = !rnd; |
3526 | 53 } |
54 } | |
55 | |
4210 | 56 /** Apply overlap transform to vertical edge |
3526 | 57 */ |
4239 | 58 static void vc1_h_overlap_c(uint8_t* src, int stride) |
3526 | 59 { |
60 int i; | |
61 int a, b, c, d; | |
4211 | 62 int d1, d2; |
4239 | 63 int rnd = 1; |
3526 | 64 for(i = 0; i < 8; i++) { |
65 a = src[-2]; | |
66 b = src[-1]; | |
67 c = src[0]; | |
68 d = src[1]; | |
4211 | 69 d1 = (a - d + 3 + rnd) >> 3; |
70 d2 = (a - d + b - c + 4 - rnd) >> 3; | |
3526 | 71 |
4211 | 72 src[-2] = a - d1; |
73 src[-1] = b - d2; | |
74 src[0] = c + d2; | |
75 src[1] = d + d1; | |
3526 | 76 src += stride; |
4239 | 77 rnd = !rnd; |
3526 | 78 } |
79 } | |
80 | |
81 | |
82 /** Do inverse transform on 8x8 block | |
83 */ | |
84 static void vc1_inv_trans_8x8_c(DCTELEM block[64]) | |
85 { | |
86 int i; | |
87 register int t1,t2,t3,t4,t5,t6,t7,t8; | |
88 DCTELEM *src, *dst; | |
89 | |
90 src = block; | |
91 dst = block; | |
92 for(i = 0; i < 8; i++){ | |
93 t1 = 12 * (src[0] + src[4]); | |
94 t2 = 12 * (src[0] - src[4]); | |
95 t3 = 16 * src[2] + 6 * src[6]; | |
96 t4 = 6 * src[2] - 16 * src[6]; | |
97 | |
98 t5 = t1 + t3; | |
99 t6 = t2 + t4; | |
100 t7 = t2 - t4; | |
101 t8 = t1 - t3; | |
102 | |
103 t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7]; | |
104 t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7]; | |
105 t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7]; | |
106 t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7]; | |
107 | |
108 dst[0] = (t5 + t1 + 4) >> 3; | |
109 dst[1] = (t6 + t2 + 4) >> 3; | |
110 dst[2] = (t7 + t3 + 4) >> 3; | |
111 dst[3] = (t8 + t4 + 4) >> 3; | |
112 dst[4] = (t8 - t4 + 4) >> 3; | |
113 dst[5] = (t7 - t3 + 4) >> 3; | |
114 dst[6] = (t6 - t2 + 4) >> 3; | |
115 dst[7] = (t5 - t1 + 4) >> 3; | |
116 | |
117 src += 8; | |
118 dst += 8; | |
119 } | |
120 | |
121 src = block; | |
122 dst = block; | |
123 for(i = 0; i < 8; i++){ | |
124 t1 = 12 * (src[ 0] + src[32]); | |
125 t2 = 12 * (src[ 0] - src[32]); | |
126 t3 = 16 * src[16] + 6 * src[48]; | |
127 t4 = 6 * src[16] - 16 * src[48]; | |
128 | |
129 t5 = t1 + t3; | |
130 t6 = t2 + t4; | |
131 t7 = t2 - t4; | |
132 t8 = t1 - t3; | |
133 | |
134 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56]; | |
135 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56]; | |
136 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; | |
137 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; | |
138 | |
139 dst[ 0] = (t5 + t1 + 64) >> 7; | |
140 dst[ 8] = (t6 + t2 + 64) >> 7; | |
141 dst[16] = (t7 + t3 + 64) >> 7; | |
142 dst[24] = (t8 + t4 + 64) >> 7; | |
143 dst[32] = (t8 - t4 + 64 + 1) >> 7; | |
144 dst[40] = (t7 - t3 + 64 + 1) >> 7; | |
145 dst[48] = (t6 - t2 + 64 + 1) >> 7; | |
146 dst[56] = (t5 - t1 + 64 + 1) >> 7; | |
147 | |
148 src++; | |
149 dst++; | |
150 } | |
151 } | |
152 | |
153 /** Do inverse transform on 8x4 part of block | |
154 */ | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
155 static void vc1_inv_trans_8x4_c(uint8_t *dest, int linesize, DCTELEM *block) |
3526 | 156 { |
157 int i; | |
158 register int t1,t2,t3,t4,t5,t6,t7,t8; | |
159 DCTELEM *src, *dst; | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
160 const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
3526 | 161 |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
162 src = block; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
163 dst = block; |
3526 | 164 for(i = 0; i < 4; i++){ |
165 t1 = 12 * (src[0] + src[4]); | |
166 t2 = 12 * (src[0] - src[4]); | |
167 t3 = 16 * src[2] + 6 * src[6]; | |
168 t4 = 6 * src[2] - 16 * src[6]; | |
169 | |
170 t5 = t1 + t3; | |
171 t6 = t2 + t4; | |
172 t7 = t2 - t4; | |
173 t8 = t1 - t3; | |
174 | |
175 t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7]; | |
176 t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7]; | |
177 t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7]; | |
178 t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7]; | |
179 | |
180 dst[0] = (t5 + t1 + 4) >> 3; | |
181 dst[1] = (t6 + t2 + 4) >> 3; | |
182 dst[2] = (t7 + t3 + 4) >> 3; | |
183 dst[3] = (t8 + t4 + 4) >> 3; | |
184 dst[4] = (t8 - t4 + 4) >> 3; | |
185 dst[5] = (t7 - t3 + 4) >> 3; | |
186 dst[6] = (t6 - t2 + 4) >> 3; | |
187 dst[7] = (t5 - t1 + 4) >> 3; | |
188 | |
189 src += 8; | |
190 dst += 8; | |
191 } | |
192 | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
193 src = block; |
3526 | 194 for(i = 0; i < 8; i++){ |
195 t1 = 17 * (src[ 0] + src[16]); | |
196 t2 = 17 * (src[ 0] - src[16]); | |
197 t3 = 22 * src[ 8]; | |
198 t4 = 22 * src[24]; | |
199 t5 = 10 * src[ 8]; | |
200 t6 = 10 * src[24]; | |
201 | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
202 dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3 + t6 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
203 dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4 + t5 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
204 dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4 - t5 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
205 dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3 - t6 + 64) >> 7)]; |
3526 | 206 |
207 src ++; | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
208 dest++; |
3526 | 209 } |
210 } | |
211 | |
212 /** Do inverse transform on 4x8 parts of block | |
213 */ | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
214 static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block) |
3526 | 215 { |
216 int i; | |
217 register int t1,t2,t3,t4,t5,t6,t7,t8; | |
218 DCTELEM *src, *dst; | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
219 const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
3526 | 220 |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
221 src = block; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
222 dst = block; |
3526 | 223 for(i = 0; i < 8; i++){ |
224 t1 = 17 * (src[0] + src[2]); | |
225 t2 = 17 * (src[0] - src[2]); | |
226 t3 = 22 * src[1]; | |
227 t4 = 22 * src[3]; | |
228 t5 = 10 * src[1]; | |
229 t6 = 10 * src[3]; | |
230 | |
231 dst[0] = (t1 + t3 + t6 + 4) >> 3; | |
232 dst[1] = (t2 - t4 + t5 + 4) >> 3; | |
233 dst[2] = (t2 + t4 - t5 + 4) >> 3; | |
234 dst[3] = (t1 - t3 - t6 + 4) >> 3; | |
235 | |
236 src += 8; | |
237 dst += 8; | |
238 } | |
239 | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
240 src = block; |
3526 | 241 for(i = 0; i < 4; i++){ |
242 t1 = 12 * (src[ 0] + src[32]); | |
243 t2 = 12 * (src[ 0] - src[32]); | |
244 t3 = 16 * src[16] + 6 * src[48]; | |
245 t4 = 6 * src[16] - 16 * src[48]; | |
246 | |
247 t5 = t1 + t3; | |
248 t6 = t2 + t4; | |
249 t7 = t2 - t4; | |
250 t8 = t1 - t3; | |
251 | |
252 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56]; | |
253 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56]; | |
254 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; | |
255 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; | |
256 | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
257 dest[0*linesize] = cm[dest[0*linesize] + ((t5 + t1 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
258 dest[1*linesize] = cm[dest[1*linesize] + ((t6 + t2 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
259 dest[2*linesize] = cm[dest[2*linesize] + ((t7 + t3 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
260 dest[3*linesize] = cm[dest[3*linesize] + ((t8 + t4 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
261 dest[4*linesize] = cm[dest[4*linesize] + ((t8 - t4 + 64 + 1) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
262 dest[5*linesize] = cm[dest[5*linesize] + ((t7 - t3 + 64 + 1) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
263 dest[6*linesize] = cm[dest[6*linesize] + ((t6 - t2 + 64 + 1) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
264 dest[7*linesize] = cm[dest[7*linesize] + ((t5 - t1 + 64 + 1) >> 7)]; |
3526 | 265 |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
266 src ++; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
267 dest++; |
3526 | 268 } |
269 } | |
270 | |
271 /** Do inverse transform on 4x4 part of block | |
272 */ | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
273 static void vc1_inv_trans_4x4_c(uint8_t *dest, int linesize, DCTELEM *block) |
3526 | 274 { |
275 int i; | |
276 register int t1,t2,t3,t4,t5,t6; | |
277 DCTELEM *src, *dst; | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
278 const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
3526 | 279 |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
280 src = block; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
281 dst = block; |
3526 | 282 for(i = 0; i < 4; i++){ |
283 t1 = 17 * (src[0] + src[2]); | |
284 t2 = 17 * (src[0] - src[2]); | |
285 t3 = 22 * src[1]; | |
286 t4 = 22 * src[3]; | |
287 t5 = 10 * src[1]; | |
288 t6 = 10 * src[3]; | |
289 | |
290 dst[0] = (t1 + t3 + t6 + 4) >> 3; | |
291 dst[1] = (t2 - t4 + t5 + 4) >> 3; | |
292 dst[2] = (t2 + t4 - t5 + 4) >> 3; | |
293 dst[3] = (t1 - t3 - t6 + 4) >> 3; | |
294 | |
295 src += 8; | |
296 dst += 8; | |
297 } | |
298 | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
299 src = block; |
3526 | 300 for(i = 0; i < 4; i++){ |
301 t1 = 17 * (src[ 0] + src[16]); | |
302 t2 = 17 * (src[ 0] - src[16]); | |
303 t3 = 22 * src[ 8]; | |
304 t4 = 22 * src[24]; | |
305 t5 = 10 * src[ 8]; | |
306 t6 = 10 * src[24]; | |
307 | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
308 dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3 + t6 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
309 dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4 + t5 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
310 dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4 - t5 + 64) >> 7)]; |
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
311 dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3 - t6 + 64) >> 7)]; |
3526 | 312 |
313 src ++; | |
5997
90de28dfd8d6
Switch VC-1 decoder to output decoded residual immediately.
kostya
parents:
5416
diff
changeset
|
314 dest++; |
3526 | 315 } |
316 } | |
317 | |
318 /* motion compensation functions */ | |
5416 | 319 /** Filter in case of 2 filters */ |
320 #define VC1_MSPEL_FILTER_16B(DIR, TYPE) \ | |
321 static av_always_inline int vc1_mspel_ ## DIR ## _filter_16bits(const TYPE *src, int stride, int mode) \ | |
322 { \ | |
323 switch(mode){ \ | |
324 case 0: /* no shift - should not occur */ \ | |
325 return 0; \ | |
326 case 1: /* 1/4 shift */ \ | |
327 return -4*src[-stride] + 53*src[0] + 18*src[stride] - 3*src[stride*2]; \ | |
328 case 2: /* 1/2 shift */ \ | |
329 return -src[-stride] + 9*src[0] + 9*src[stride] - src[stride*2]; \ | |
330 case 3: /* 3/4 shift */ \ | |
331 return -3*src[-stride] + 18*src[0] + 53*src[stride] - 4*src[stride*2]; \ | |
332 } \ | |
333 return 0; /* should not occur */ \ | |
334 } | |
335 | |
336 VC1_MSPEL_FILTER_16B(ver, uint8_t); | |
337 VC1_MSPEL_FILTER_16B(hor, int16_t); | |
338 | |
3526 | 339 |
340 /** Filter used to interpolate fractional pel values | |
341 */ | |
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4239
diff
changeset
|
342 static av_always_inline int vc1_mspel_filter(const uint8_t *src, int stride, int mode, int r) |
3526 | 343 { |
344 switch(mode){ | |
345 case 0: //no shift | |
346 return src[0]; | |
347 case 1: // 1/4 shift | |
348 return (-4*src[-stride] + 53*src[0] + 18*src[stride] - 3*src[stride*2] + 32 - r) >> 6; | |
349 case 2: // 1/2 shift | |
350 return (-src[-stride] + 9*src[0] + 9*src[stride] - src[stride*2] + 8 - r) >> 4; | |
351 case 3: // 3/4 shift | |
352 return (-3*src[-stride] + 18*src[0] + 53*src[stride] - 4*src[stride*2] + 32 - r) >> 6; | |
353 } | |
354 return 0; //should not occur | |
355 } | |
356 | |
357 /** Function used to do motion compensation with bicubic interpolation | |
358 */ | |
5253
a69976bf878c
Pass modes as parameters instead of calculating them inplace.
kostya
parents:
5252
diff
changeset
|
359 static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int hmode, int vmode, int rnd) |
3526 | 360 { |
5416 | 361 int i, j; |
362 | |
363 if (vmode) { /* Horizontal filter to apply */ | |
364 int r; | |
365 | |
366 if (hmode) { /* Vertical filter to apply, output to tmp */ | |
367 static const int shift_value[] = { 0, 5, 1, 5 }; | |
368 int shift = (shift_value[hmode]+shift_value[vmode])>>1; | |
369 int16_t tmp[11*8], *tptr = tmp; | |
370 | |
371 r = (1<<(shift-1)) + rnd-1; | |
372 | |
373 src -= 1; | |
374 for(j = 0; j < 8; j++) { | |
375 for(i = 0; i < 11; i++) | |
376 tptr[i] = (vc1_mspel_ver_filter_16bits(src + i, stride, vmode)+r)>>shift; | |
377 src += stride; | |
378 tptr += 11; | |
379 } | |
3526 | 380 |
5416 | 381 r = 64-rnd; |
382 tptr = tmp+1; | |
383 for(j = 0; j < 8; j++) { | |
384 for(i = 0; i < 8; i++) | |
385 dst[i] = av_clip_uint8((vc1_mspel_hor_filter_16bits(tptr + i, 1, hmode)+r)>>7); | |
386 dst += stride; | |
387 tptr += 11; | |
388 } | |
389 | |
390 return; | |
391 } | |
392 else { /* No horizontal filter, output 8 lines to dst */ | |
393 r = 1-rnd; | |
394 | |
395 for(j = 0; j < 8; j++) { | |
396 for(i = 0; i < 8; i++) | |
397 dst[i] = av_clip_uint8(vc1_mspel_filter(src + i, stride, vmode, r)); | |
398 src += stride; | |
399 dst += stride; | |
400 } | |
401 return; | |
402 } | |
3526 | 403 } |
404 | |
5416 | 405 /* Horizontal mode with no vertical mode */ |
3526 | 406 for(j = 0; j < 8; j++) { |
407 for(i = 0; i < 8; i++) | |
5416 | 408 dst[i] = av_clip_uint8(vc1_mspel_filter(src + i, 1, hmode, rnd)); |
3526 | 409 dst += stride; |
5416 | 410 src += stride; |
3526 | 411 } |
412 } | |
413 | |
414 /* pixel functions - really are entry points to vc1_mspel_mc */ | |
415 | |
416 /* this one is defined in dsputil.c */ | |
417 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd); | |
418 | |
5252 | 419 #define PUT_VC1_MSPEL(a, b)\ |
420 static void put_vc1_mspel_mc ## a ## b ##_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \ | |
5253
a69976bf878c
Pass modes as parameters instead of calculating them inplace.
kostya
parents:
5252
diff
changeset
|
421 vc1_mspel_mc(dst, src, stride, a, b, rnd); \ |
3526 | 422 } |
423 | |
5252 | 424 PUT_VC1_MSPEL(1, 0) |
425 PUT_VC1_MSPEL(2, 0) | |
426 PUT_VC1_MSPEL(3, 0) | |
3526 | 427 |
5252 | 428 PUT_VC1_MSPEL(0, 1) |
429 PUT_VC1_MSPEL(1, 1) | |
430 PUT_VC1_MSPEL(2, 1) | |
431 PUT_VC1_MSPEL(3, 1) | |
3526 | 432 |
5252 | 433 PUT_VC1_MSPEL(0, 2) |
434 PUT_VC1_MSPEL(1, 2) | |
435 PUT_VC1_MSPEL(2, 2) | |
436 PUT_VC1_MSPEL(3, 2) | |
3526 | 437 |
5252 | 438 PUT_VC1_MSPEL(0, 3) |
439 PUT_VC1_MSPEL(1, 3) | |
440 PUT_VC1_MSPEL(2, 3) | |
441 PUT_VC1_MSPEL(3, 3) | |
3526 | 442 |
443 void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) { | |
444 dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c; | |
445 dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c; | |
446 dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c; | |
447 dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c; | |
448 dsp->vc1_h_overlap = vc1_h_overlap_c; | |
449 dsp->vc1_v_overlap = vc1_v_overlap_c; | |
450 | |
451 dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_c; | |
5251 | 452 dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_c; |
453 dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_c; | |
454 dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_c; | |
455 dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_c; | |
456 dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_c; | |
457 dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_c; | |
458 dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_c; | |
459 dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_c; | |
460 dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_c; | |
461 dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_c; | |
462 dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_c; | |
463 dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_c; | |
464 dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_c; | |
465 dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_c; | |
466 dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_c; | |
3526 | 467 } |