History

Add half-pixel variance RTCD functions

NEON has optimized 16x16 half-pixel variance functions, but they were not part of the RTCD framework. Add these functions to RTCD, so that other platforms can make use of this optimization in the future and special-case ARM code can be removed. A number of functions were taking two variance functions as parameters. These functions were changed to take a single parameter, a pointer to a struct containing all the variance functions for that block size. This provides additional flexibility for calling additional variance functions (the half-pixel special case, for example) and by initializing the table for all block sizes, we don't have to construct this function pointer table for each macroblock.

John Koleszar committed 16 years ago

Commit 209d82a1 parent d6c67f014 files · +197 −761Browse files

Unified · Split

14 files
  1. vp8/encoder/arm/mcomp_arm.c +0 −615
  2. vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm +9 −9
  3. vp8/encoder/arm/variance_arm.h +12 −0
  4. vp8/encoder/firstpass.c +2 −3
  5. vp8/encoder/mcomp.c +45 −50
  6. vp8/encoder/mcomp.h +4 −3
  7. vp8/encoder/onyx_if.c +44 −5
  8. vp8/encoder/onyx_int.h +11 −1
  9. vp8/encoder/pickinter.c +10 −11
  10. vp8/encoder/rdopt.c +17 −49
  11. vp8/encoder/temporal_filter.c +5 −5
  12. vp8/encoder/variance.h +25 −7
  13. vp8/encoder/variance_c.c +13 −2
  14. vp8/vp8cx_arm.mk +0 −1
vp8/encoder/arm/mcomp_arm.c+0−615
@@ -1,615 +0,0 @@
1/*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11
12#include "mcomp.h"
13#include "vpx_mem/vpx_mem.h"
14
15#include <stdio.h>
16#include <limits.h>
17#include <math.h>
18
19#ifdef ENTROPY_STATS
20static int mv_ref_ct [31] [4] [2];
21static int mv_mode_cts [4] [2];
22#endif
23
24extern unsigned int vp8_sub_pixel_variance16x16s_neon
25(
26 unsigned char *src_ptr,
27 int src_pixels_per_line,
28 int xoffset,
29 int yoffset,
30 unsigned char *dst_ptr,
31 int dst_pixels_per_line,
32 unsigned int *sse
33);
34extern unsigned int vp8_sub_pixel_variance16x16s_4_0_neon
35(
36 unsigned char *src_ptr,
37 int src_pixels_per_line,
38 unsigned char *dst_ptr,
39 int dst_pixels_per_line,
40 unsigned int *sse
41);
42extern unsigned int vp8_sub_pixel_variance16x16s_0_4_neon
43(
44 unsigned char *src_ptr,
45 int src_pixels_per_line,
46 unsigned char *dst_ptr,
47 int dst_pixels_per_line,
48 unsigned int *sse
49);
50extern unsigned int vp8_sub_pixel_variance16x16s_4_4_neon
51(
52 unsigned char *src_ptr,
53 int src_pixels_per_line,
54 unsigned char *dst_ptr,
55 int dst_pixels_per_line,
56 unsigned int *sse
57);
58
59
60int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, int *mvcost[2])
61{
62 int bestmse = INT_MAX;
63 MV startmv;
64 //MV this_mv;
65 MV this_mv;
66 unsigned char *y = *(d->base_pre) + d->pre + (bestmv->row) * d->pre_stride + bestmv->col;
67 unsigned char *z = (*(b->base_src) + b->src);
68 int left, right, up, down, diag;
69 unsigned int sse;
70 int whichdir ;
71
72
73 // Trap uncodable vectors
74 if ((abs((bestmv->col << 3) - ref_mv->col) > MAX_FULL_PEL_VAL) || (abs((bestmv->row << 3) - ref_mv->row) > MAX_FULL_PEL_VAL))
75 {
76 bestmv->row <<= 3;
77 bestmv->col <<= 3;
78 return INT_MAX;
79 }
80
81 // central mv
82 bestmv->row <<= 3;
83 bestmv->col <<= 3;
84 startmv = *bestmv;
85
86 // calculate central point error
87 bestmse = vf(y, d->pre_stride, z, b->src_stride, &sse);
88 bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
89
90 // go left then right and check error
91 this_mv.row = startmv.row;
92 this_mv.col = ((startmv.col - 8) | 4);
93 left = vp8_sub_pixel_variance16x16s_4_0_neon(y - 1, d->pre_stride, z, b->src_stride, &sse);
94 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
95
96 if (left < bestmse)
97 {
98 *bestmv = this_mv;
99 bestmse = left;
100 }
101
102 this_mv.col += 8;
103 right = vp8_sub_pixel_variance16x16s_4_0_neon(y, d->pre_stride, z, b->src_stride, &sse);
104 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
105
106 if (right < bestmse)
107 {
108 *bestmv = this_mv;
109 bestmse = right;
110 }
111
112 // go up then down and check error
113 this_mv.col = startmv.col;
114 this_mv.row = ((startmv.row - 8) | 4);
115 up = vp8_sub_pixel_variance16x16s_0_4_neon(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
116 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
117
118 if (up < bestmse)
119 {
120 *bestmv = this_mv;
121 bestmse = up;
122 }
123
124 this_mv.row += 8;
125 down = vp8_sub_pixel_variance16x16s_0_4_neon(y, d->pre_stride, z, b->src_stride, &sse);
126 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
127
128 if (down < bestmse)
129 {
130 *bestmv = this_mv;
131 bestmse = down;
132 }
133
134
135 // now check 1 more diagonal
136 whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
137 //for(whichdir =0;whichdir<4;whichdir++)
138 //{
139 this_mv = startmv;
140
141 switch (whichdir)
142 {
143 case 0:
144 this_mv.col = (this_mv.col - 8) | 4;
145 this_mv.row = (this_mv.row - 8) | 4;
146 diag = vp8_sub_pixel_variance16x16s_4_4_neon(y - 1 - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
147 break;
148 case 1:
149 this_mv.col += 4;
150 this_mv.row = (this_mv.row - 8) | 4;
151 diag = vp8_sub_pixel_variance16x16s_4_4_neon(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
152 break;
153 case 2:
154 this_mv.col = (this_mv.col - 8) | 4;
155 this_mv.row += 4;
156 diag = vp8_sub_pixel_variance16x16s_4_4_neon(y - 1, d->pre_stride, z, b->src_stride, &sse);
157 break;
158 case 3:
159 this_mv.col += 4;
160 this_mv.row += 4;
161 diag = vp8_sub_pixel_variance16x16s_4_4_neon(y, d->pre_stride, z, b->src_stride, &sse);
162 break;
163 }
164
165 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
166
167 if (diag < bestmse)
168 {
169 *bestmv = this_mv;
170 bestmse = diag;
171 }
172
173// }
174
175
176 // time to check quarter pels.
177 if (bestmv->row < startmv.row)
178 y -= d->pre_stride;
179
180 if (bestmv->col < startmv.col)
181 y--;
182
183 startmv = *bestmv;
184
185
186
187 // go left then right and check error
188 this_mv.row = startmv.row;
189
190 if (startmv.col & 7)
191 {
192 this_mv.col = startmv.col - 2;
193 left = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
194 }
195 else
196 {
197 this_mv.col = (startmv.col - 8) | 6;
198 left = svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);
199 }
200
201 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
202
203 if (left < bestmse)
204 {
205 *bestmv = this_mv;
206 bestmse = left;
207 }
208
209 this_mv.col += 4;
210 right = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
211 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
212
213 if (right < bestmse)
214 {
215 *bestmv = this_mv;
216 bestmse = right;
217 }
218
219 // go up then down and check error
220 this_mv.col = startmv.col;
221
222 if (startmv.row & 7)
223 {
224 this_mv.row = startmv.row - 2;
225 up = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
226 }
227 else
228 {
229 this_mv.row = (startmv.row - 8) | 6;
230 up = svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);
231 }
232
233 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
234
235 if (up < bestmse)
236 {
237 *bestmv = this_mv;
238 bestmse = up;
239 }
240
241 this_mv.row += 4;
242 down = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
243 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
244
245 if (down < bestmse)
246 {
247 *bestmv = this_mv;
248 bestmse = down;
249 }
250
251
252 // now check 1 more diagonal
253 whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
254
255// for(whichdir=0;whichdir<4;whichdir++)
256// {
257 this_mv = startmv;
258
259 switch (whichdir)
260 {
261 case 0:
262
263 if (startmv.row & 7)
264 {
265 this_mv.row -= 2;
266
267 if (startmv.col & 7)
268 {
269 this_mv.col -= 2;
270 diag = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
271 }
272 else
273 {
274 this_mv.col = (startmv.col - 8) | 6;
275 diag = svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);;
276 }
277 }
278 else
279 {
280 this_mv.row = (startmv.row - 8) | 6;
281
282 if (startmv.col & 7)
283 {
284 this_mv.col -= 2;
285 diag = svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);
286 }
287 else
288 {
289 this_mv.col = (startmv.col - 8) | 6;
290 diag = svf(y - d->pre_stride - 1, d->pre_stride, 6, 6, z, b->src_stride, &sse);
291 }
292 }
293
294 break;
295 case 1:
296 this_mv.col += 2;
297
298 if (startmv.row & 7)
299 {
300 this_mv.row -= 2;
301 diag = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
302 }
303 else
304 {
305 this_mv.row = (startmv.row - 8) | 6;
306 diag = svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);
307 }
308
309 break;
310 case 2:
311 this_mv.row += 2;
312
313 if (startmv.col & 7)
314 {
315 this_mv.col -= 2;
316 diag = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
317 }
318 else
319 {
320 this_mv.col = (startmv.col - 8) | 6;
321 diag = svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);;
322 }
323
324 break;
325 case 3:
326 this_mv.col += 2;
327 this_mv.row += 2;
328 diag = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
329 break;
330 }
331
332 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
333
334 if (diag < bestmse)
335 {
336 *bestmv = this_mv;
337 bestmse = diag;
338 }
339
340// }
341
342 return bestmse;
343}
344
345int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, int *mvcost[2])
346{
347 int bestmse = INT_MAX;
348 MV startmv;
349 //MV this_mv;
350 MV this_mv;
351 unsigned char *y = *(d->base_pre) + d->pre + (bestmv->row) * d->pre_stride + bestmv->col;
352 unsigned char *z = (*(b->base_src) + b->src);
353 int left, right, up, down, diag;
354 unsigned int sse;
355
356 // Trap uncodable vectors
357 if ((abs((bestmv->col << 3) - ref_mv->col) > MAX_FULL_PEL_VAL) || (abs((bestmv->row << 3) - ref_mv->row) > MAX_FULL_PEL_VAL))
358 {
359 bestmv->row <<= 3;
360 bestmv->col <<= 3;
361 return INT_MAX;
362 }
363
364 // central mv
365 bestmv->row <<= 3;
366 bestmv->col <<= 3;
367 startmv = *bestmv;
368
369 // calculate central point error
370 bestmse = vf(y, d->pre_stride, z, b->src_stride, &sse);
371 bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
372
373 // go left then right and check error
374 this_mv.row = startmv.row;
375 this_mv.col = ((startmv.col - 8) | 4);
376 left = vp8_sub_pixel_variance16x16s_4_0_neon(y - 1, d->pre_stride, z, b->src_stride, &sse);
377 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
378
379 if (left < bestmse)
380 {
381 *bestmv = this_mv;
382 bestmse = left;
383 }
384
385 this_mv.col += 8;
386 right = vp8_sub_pixel_variance16x16s_4_0_neon(y, d->pre_stride, z, b->src_stride, &sse);
387 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
388
389 if (right < bestmse)
390 {
391 *bestmv = this_mv;
392 bestmse = right;
393 }
394
395 // go up then down and check error
396 this_mv.col = startmv.col;
397 this_mv.row = ((startmv.row - 8) | 4);
398 up = vp8_sub_pixel_variance16x16s_0_4_neon(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
399 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
400
401 if (up < bestmse)
402 {
403 *bestmv = this_mv;
404 bestmse = up;
405 }
406
407 this_mv.row += 8;
408 down = vp8_sub_pixel_variance16x16s_0_4_neon(y, d->pre_stride, z, b->src_stride, &sse);
409 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
410
411 if (down < bestmse)
412 {
413 *bestmv = this_mv;
414 bestmse = down;
415 }
416
417 // somewhat strangely not doing all the diagonals for half pel is slower than doing them.
418#if 0
419 // now check 1 more diagonal -
420 whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
421 this_mv = startmv;
422
423 switch (whichdir)
424 {
425 case 0:
426 this_mv.col = (this_mv.col - 8) | 4;
427 this_mv.row = (this_mv.row - 8) | 4;
428 diag = svf(y - 1 - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);
429 break;
430 case 1:
431 this_mv.col += 4;
432 this_mv.row = (this_mv.row - 8) | 4;
433 diag = svf(y - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);
434 break;
435 case 2:
436 this_mv.col = (this_mv.col - 8) | 4;
437 this_mv.row += 4;
438 diag = svf(y - 1, d->pre_stride, 4, 4, z, b->src_stride, &sse);
439 break;
440 case 3:
441 this_mv.col += 4;
442 this_mv.row += 4;
443 diag = svf(y, d->pre_stride, 4, 4, z, b->src_stride, &sse);
444 break;
445 }
446
447 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
448
449 if (diag < bestmse)
450 {
451 *bestmv = this_mv;
452 bestmse = diag;
453 }
454
455#else
456 this_mv.col = (this_mv.col - 8) | 4;
457 this_mv.row = (this_mv.row - 8) | 4;
458 diag = vp8_sub_pixel_variance16x16s_4_4_neon(y - 1 - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
459 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
460
461 if (diag < bestmse)
462 {
463 *bestmv = this_mv;
464 bestmse = diag;
465 }
466
467 this_mv.col += 8;
468 diag = vp8_sub_pixel_variance16x16s_4_4_neon(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
469 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
470
471 if (diag < bestmse)
472 {
473 *bestmv = this_mv;
474 bestmse = diag;
475 }
476
477 this_mv.col = (this_mv.col - 8) | 4;
478 this_mv.row = startmv.row + 4;
479 diag = vp8_sub_pixel_variance16x16s_4_4_neon(y - 1, d->pre_stride, z, b->src_stride, &sse);
480 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
481
482 if (diag < bestmse)
483 {
484 *bestmv = this_mv;
485 bestmse = diag;
486 }
487
488 this_mv.col += 8;
489 diag = vp8_sub_pixel_variance16x16s_4_4_neon(y, d->pre_stride, z, b->src_stride, &sse);
490 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
491
492 if (diag < bestmse)
493 {
494 *bestmv = this_mv;
495 bestmse = diag;
496 }
497
498#endif
499 return bestmse;
500}
501
502
503#ifdef ENTROPY_STATS
504void print_mode_context(void)
505{
506 FILE *f = fopen("modecont.c", "w");
507 int i, j;
508
509 fprintf(f, "#include \"entropy.h\"\n");
510 fprintf(f, "const int vp8_mode_contexts[6][4] =\n");
511 fprintf(f, "{\n");
512
513 for (j = 0; j < 6; j++)
514 {
515 fprintf(f, " { // %d \n", j);
516 fprintf(f, " ");
517
518 for (i = 0; i < 4; i++)
519 {
520 int overal_prob;
521 int this_prob;
522 int count; // = mv_ref_ct[j][i][0]+mv_ref_ct[j][i][1];
523
524 // Overall probs
525 count = mv_mode_cts[i][0] + mv_mode_cts[i][1];
526
527 if (count)
528 overal_prob = 256 * mv_mode_cts[i][0] / count;
529 else
530 overal_prob = 128;
531
532 if (overal_prob == 0)
533 overal_prob = 1;
534
535 // context probs
536 count = mv_ref_ct[j][i][0] + mv_ref_ct[j][i][1];
537
538 if (count)
539 this_prob = 256 * mv_ref_ct[j][i][0] / count;
540 else
541 this_prob = 128;
542
543 if (this_prob == 0)
544 this_prob = 1;
545
546 fprintf(f, "%5d, ", this_prob);
547 //fprintf(f,"%5d, %5d, %8d,", this_prob, overal_prob, (this_prob << 10)/overal_prob);
548 //fprintf(f,"%8d, ", (this_prob << 10)/overal_prob);
549 }
550
551 fprintf(f, " },\n");
552 }
553
554 fprintf(f, "};\n");
555 fclose(f);
556}
557
558/* MV ref count ENTROPY_STATS stats code */
559#ifdef ENTROPY_STATS
560void init_mv_ref_counts()
561{
562 vpx_memset(mv_ref_ct, 0, sizeof(mv_ref_ct));
563 vpx_memset(mv_mode_cts, 0, sizeof(mv_mode_cts));
564}
565
566void accum_mv_refs(MB_PREDICTION_MODE m, const int ct[4])
567{
568 if (m == ZEROMV)
569 {
570 ++mv_ref_ct [ct[0]] [0] [0];
571 ++mv_mode_cts[0][0];
572 }
573 else
574 {
575 ++mv_ref_ct [ct[0]] [0] [1];
576 ++mv_mode_cts[0][1];
577
578 if (m == NEARESTMV)
579 {
580 ++mv_ref_ct [ct[1]] [1] [0];
581 ++mv_mode_cts[1][0];
582 }
583 else
584 {
585 ++mv_ref_ct [ct[1]] [1] [1];
586 ++mv_mode_cts[1][1];
587
588 if (m == NEARMV)
589 {
590 ++mv_ref_ct [ct[2]] [2] [0];
591 ++mv_mode_cts[2][0];
592 }
593 else
594 {
595 ++mv_ref_ct [ct[2]] [2] [1];
596 ++mv_mode_cts[2][1];
597
598 if (m == NEWMV)
599 {
600 ++mv_ref_ct [ct[3]] [3] [0];
601 ++mv_mode_cts[3][0];
602 }
603 else
604 {
605 ++mv_ref_ct [ct[3]] [3] [1];
606 ++mv_mode_cts[3][1];
607 }
608 }
609 }
610 }
611}
612
613#endif/* END MV ref count ENTROPY_STATS stats code */
614
615#endif
vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm+9−9
@@ -9,9 +9,9 @@ · 8 unmodified lines
9;9;
10 10
11 11
12 EXPORT |vp8_sub_pixel_variance16x16s_4_0_neon|12 EXPORT |vp8_variance_halfpixvar16x16_h_neon|
13 EXPORT |vp8_sub_pixel_variance16x16s_0_4_neon|13 EXPORT |vp8_variance_halfpixvar16x16_v_neon|
14 EXPORT |vp8_sub_pixel_variance16x16s_4_4_neon|14 EXPORT |vp8_variance_halfpixvar16x16_hv_neon|
15 EXPORT |vp8_sub_pixel_variance16x16s_neon|15 EXPORT |vp8_sub_pixel_variance16x16s_neon|
16 ARM16 ARM
17 REQUIRE817 REQUIRE8
@@ -20,7 +20,7 @@ · 2 unmodified lines
20 AREA ||.text||, CODE, READONLY, ALIGN=220 AREA ||.text||, CODE, READONLY, ALIGN=2
21 21
22;================================================22;================================================
23;unsigned int vp8_sub_pixel_variance16x16s_4_0_neon23;unsigned int vp8_variance_halfpixvar16x16_h_neon
24;(24;(
25; unsigned char *src_ptr, r025; unsigned char *src_ptr, r0
26; int src_pixels_per_line, r126; int src_pixels_per_line, r1
@@ -29,7 +29,7 @@ · 2 unmodified lines
29; unsigned int *sse29; unsigned int *sse
30;);30;);
31;================================================31;================================================
32|vp8_sub_pixel_variance16x16s_4_0_neon| PROC32|vp8_variance_halfpixvar16x16_h_neon| PROC
33 push {lr}33 push {lr}
34 34
35 mov r12, #4 ;loop counter35 mov r12, #4 ;loop counter
@@ -120,7 +120,7 @@ vp8_filt_fpo16x16s_4_0_loop_neon · 84 unmodified lines
120 ENDP120 ENDP
121 121
122;================================================122;================================================
123;unsigned int vp8_sub_pixel_variance16x16s_0_4_neon123;unsigned int vp8_variance_halfpixvar16x16_v_neon
124;(124;(
125; unsigned char *src_ptr, r0125; unsigned char *src_ptr, r0
126; int src_pixels_per_line, r1126; int src_pixels_per_line, r1
@@ -129,7 +129,7 @@ vp8_filt_fpo16x16s_4_0_loop_neon · 2 unmodified lines
129; unsigned int *sse129; unsigned int *sse
130;);130;);
131;================================================131;================================================
132|vp8_sub_pixel_variance16x16s_0_4_neon| PROC132|vp8_variance_halfpixvar16x16_v_neon| PROC
133 push {lr}133 push {lr}
134 134
135 mov r12, #4 ;loop counter135 mov r12, #4 ;loop counter
@@ -216,7 +216,7 @@ vp8_filt_spo16x16s_0_4_loop_neon · 80 unmodified lines
216 ENDP216 ENDP
217 217
218;================================================218;================================================
219;unsigned int vp8_sub_pixel_variance16x16s_4_4_neon219;unsigned int vp8_variance_halfpixvar16x16_hv_neon
220;(220;(
221; unsigned char *src_ptr, r0221; unsigned char *src_ptr, r0
222; int src_pixels_per_line, r1222; int src_pixels_per_line, r1
@@ -225,7 +225,7 @@ vp8_filt_spo16x16s_0_4_loop_neon · 2 unmodified lines
225; unsigned int *sse225; unsigned int *sse
226;);226;);
227;================================================227;================================================
228|vp8_sub_pixel_variance16x16s_4_4_neon| PROC228|vp8_variance_halfpixvar16x16_hv_neon| PROC
229 push {lr}229 push {lr}
230 230
231 vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data231 vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
vp8/encoder/arm/variance_arm.h+12−0
@@ -30,6 +30,9 @@ extern prototype_subpixvariance(vp8_sub_pixel_variance8x8_neon); · 29 unmodified lines
30//extern prototype_subpixvariance(vp8_sub_pixel_variance8x16_c);30//extern prototype_subpixvariance(vp8_sub_pixel_variance8x16_c);
31//extern prototype_subpixvariance(vp8_sub_pixel_variance16x8_c);31//extern prototype_subpixvariance(vp8_sub_pixel_variance16x8_c);
32extern prototype_subpixvariance(vp8_sub_pixel_variance16x16_neon);32extern prototype_subpixvariance(vp8_sub_pixel_variance16x16_neon);
33extern prototype_variance(vp8_variance_halfpixvar16x16_h_neon);
34extern prototype_variance(vp8_variance_halfpixvar16x16_v_neon);
35extern prototype_variance(vp8_variance_halfpixvar16x16_hv_neon);
33 36
34//extern prototype_getmbss(vp8_get_mb_ss_c);37//extern prototype_getmbss(vp8_get_mb_ss_c);
35extern prototype_variance(vp8_mse16x16_neon);38extern prototype_variance(vp8_mse16x16_neon);
@@ -84,6 +87,15 @@ extern prototype_sad(vp8_get4x4sse_cs_neon); · 48 unmodified lines
84#undef vp8_variance_subpixvar16x1687#undef vp8_variance_subpixvar16x16
85#define vp8_variance_subpixvar16x16 vp8_sub_pixel_variance16x16_neon88#define vp8_variance_subpixvar16x16 vp8_sub_pixel_variance16x16_neon
86 89
90#undef vp8_variance_halfpixvar16x16_h
91#define vp8_variance_halfpixvar16x16_h vp8_variance_halfpixvar16x16_h_neon
92
93#undef vp8_variance_halfpixvar16x16_v
94#define vp8_variance_halfpixvar16x16_v vp8_variance_halfpixvar16x16_v_neon
95
96#undef vp8_variance_halfpixvar16x16_hv
97#define vp8_variance_halfpixvar16x16_hv vp8_variance_halfpixvar16x16_hv_neon
98
87//#undef vp8_variance_getmbss99//#undef vp8_variance_getmbss
88//#define vp8_variance_getmbss vp8_get_mb_ss_c100//#define vp8_variance_getmbss vp8_get_mb_ss_c
89 101
vp8/encoder/firstpass.c+2−3
@@ -462,12 +462,11 @@ void vp8_first_pass_motion_search(VP8_COMP *cpi, MACROBLOCK *x, MV *ref_mv, MV * · 461 unmodified lines
462 int step_param = 3; //3; // Dont search over full range for first pass462 int step_param = 3; //3; // Dont search over full range for first pass
463 int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param; //3;463 int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param; //3;
464 int n;464 int n;
465 vp8_variance_fn_ptr_t v_fn_ptr;465 vp8_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
466 int new_mv_mode_penalty = 256;466 int new_mv_mode_penalty = 256;
467 467
468 // override the default variance function to use MSE
468 v_fn_ptr.vf = VARIANCE_INVOKE(IF_RTCD(&cpi->rtcd.variance), mse16x16);469 v_fn_ptr.vf = VARIANCE_INVOKE(IF_RTCD(&cpi->rtcd.variance), mse16x16);
469 v_fn_ptr.sdf = cpi->fn_ptr.sdf;
470 v_fn_ptr.sdx4df = cpi->fn_ptr.sdx4df;
471 470
472 // Set up pointers for this macro block recon buffer471 // Set up pointers for this macro block recon buffer
473 xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset;472 xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset;
vp8/encoder/mcomp.c+45−50
@@ -186,7 +186,7 @@ void vp8_init3smotion_compensation(MACROBLOCK *x, int stride) · 185 unmodified lines
186#define MVC(r,c) (((mvcost[0][(r)-rr] + mvcost[1][(c) - rc]) * error_per_bit + 128 )>>8 ) // estimated cost of a motion vector (r,c)186#define MVC(r,c) (((mvcost[0][(r)-rr] + mvcost[1][(c) - rc]) * error_per_bit + 128 )>>8 ) // estimated cost of a motion vector (r,c)
187#define PRE(r,c) (*(d->base_pre) + d->pre + ((r)>>2) * d->pre_stride + ((c)>>2)) // pointer to predictor base of a motionvector187#define PRE(r,c) (*(d->base_pre) + d->pre + ((r)>>2) * d->pre_stride + ((c)>>2)) // pointer to predictor base of a motionvector
188#define SP(x) (((x)&3)<<1) // convert motion vector component to offset for svf calc188#define SP(x) (((x)&3)<<1) // convert motion vector component to offset for svf calc
189#define DIST(r,c) svf( PRE(r,c), d->pre_stride, SP(c),SP(r), z,b->src_stride,&sse) // returns subpixel variance error function.189#define DIST(r,c) vfp->svf( PRE(r,c), d->pre_stride, SP(c),SP(r), z,b->src_stride,&sse) // returns subpixel variance error function.
190#define IFMVCV(r,c,s,e) if ( c >= minc && c <= maxc && r >= minr && r <= maxr) s else e;190#define IFMVCV(r,c,s,e) if ( c >= minc && c <= maxc && r >= minr && r <= maxr) s else e;
191#define ERR(r,c) (MVC(r,c)+DIST(r,c)) // returns distortion + motion vector cost191#define ERR(r,c) (MVC(r,c)+DIST(r,c)) // returns distortion + motion vector cost
192#define CHECK_BETTER(v,r,c) IFMVCV(r,c,{if((v = ERR(r,c)) < besterr) { besterr = v; br=r; bc=c; }}, v=INT_MAX;)// checks if (r,c) has better score than previous best192#define CHECK_BETTER(v,r,c) IFMVCV(r,c,{if((v = ERR(r,c)) < besterr) { besterr = v; br=r; bc=c; }}, v=INT_MAX;)// checks if (r,c) has better score than previous best
@@ -195,7 +195,7 @@ void vp8_init3smotion_compensation(MACROBLOCK *x, int stride) · 2 unmodified lines
195 195
196//#define CHECK_BETTER(v,r,c) if((v = ERR(r,c)) < besterr) { besterr = v; br=r; bc=c; }196//#define CHECK_BETTER(v,r,c) if((v = ERR(r,c)) < besterr) { besterr = v; br=r; bc=c; }
197 197
198int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, int *mvcost[2])198int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2])
199{199{
200 unsigned char *y = *(d->base_pre) + d->pre + (bestmv->row) * d->pre_stride + bestmv->col;200 unsigned char *y = *(d->base_pre) + d->pre + (bestmv->row) * d->pre_stride + bestmv->col;
201 unsigned char *z = (*(b->base_src) + b->src);201 unsigned char *z = (*(b->base_src) + b->src);
@@ -220,7 +220,7 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, · 18 unmodified lines
220 bestmv->col <<= 3;220 bestmv->col <<= 3;
221 221
222 // calculate central point error222 // calculate central point error
223 besterr = vf(y, d->pre_stride, z, b->src_stride, &sse);223 besterr = vfp->vf(y, d->pre_stride, z, b->src_stride, &sse);
224 besterr += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);224 besterr += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
225 225
226 // TODO: Each subsequent iteration checks at least one point in common with the last iteration could be 2 ( if diag selected)226 // TODO: Each subsequent iteration checks at least one point in common with the last iteration could be 2 ( if diag selected)
@@ -309,7 +309,7 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, · 82 unmodified lines
309#undef CHECK_BETTER309#undef CHECK_BETTER
310#undef MIN310#undef MIN
311#undef MAX311#undef MAX
312int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, int *mvcost[2])312int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2])
313{313{
314 int bestmse = INT_MAX;314 int bestmse = INT_MAX;
315 MV startmv;315 MV startmv;
@@ -336,13 +336,13 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 20 unmodified lines
336 startmv = *bestmv;336 startmv = *bestmv;
337 337
338 // calculate central point error338 // calculate central point error
339 bestmse = vf(y, d->pre_stride, z, b->src_stride, &sse);339 bestmse = vfp->vf(y, d->pre_stride, z, b->src_stride, &sse);
340 bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);340 bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
341 341
342 // go left then right and check error342 // go left then right and check error
343 this_mv.row = startmv.row;343 this_mv.row = startmv.row;
344 this_mv.col = ((startmv.col - 8) | 4);344 this_mv.col = ((startmv.col - 8) | 4);
345 left = svf(y - 1, d->pre_stride, 4, 0, z, b->src_stride, &sse);345 left = vfp->svf_halfpix_h(y - 1, d->pre_stride, z, b->src_stride, &sse);
346 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);346 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
347 347
348 if (left < bestmse)348 if (left < bestmse)
@@ -352,7 +352,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 3 unmodified lines
352 }352 }
353 353
354 this_mv.col += 8;354 this_mv.col += 8;
355 right = svf(y, d->pre_stride, 4, 0, z, b->src_stride, &sse);355 right = vfp->svf_halfpix_h(y, d->pre_stride, z, b->src_stride, &sse);
356 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);356 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
357 357
358 if (right < bestmse)358 if (right < bestmse)
@@ -364,7 +364,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 5 unmodified lines
364 // go up then down and check error364 // go up then down and check error
365 this_mv.col = startmv.col;365 this_mv.col = startmv.col;
366 this_mv.row = ((startmv.row - 8) | 4);366 this_mv.row = ((startmv.row - 8) | 4);
367 up = svf(y - d->pre_stride, d->pre_stride, 0, 4, z, b->src_stride, &sse);367 up = vfp->svf_halfpix_v(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
368 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);368 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
369 369
370 if (up < bestmse)370 if (up < bestmse)
@@ -374,7 +374,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 3 unmodified lines
374 }374 }
375 375
376 this_mv.row += 8;376 this_mv.row += 8;
377 down = svf(y, d->pre_stride, 0, 4, z, b->src_stride, &sse);377 down = vfp->svf_halfpix_v(y, d->pre_stride, z, b->src_stride, &sse);
378 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);378 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
379 379
380 if (down < bestmse)380 if (down < bestmse)
@@ -386,10 +386,6 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 5 unmodified lines
386 386
387 // now check 1 more diagonal387 // now check 1 more diagonal
388 whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);388 whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
389 // whichdir must be 0-4. Therefore, one of the cases below
390 // must run through. However, because there is no default
391 // and diag is not set elsewhere, we get a compile warning
392 diag = 0;
393 //for(whichdir =0;whichdir<4;whichdir++)389 //for(whichdir =0;whichdir<4;whichdir++)
394 //{390 //{
395 this_mv = startmv;391 this_mv = startmv;
@@ -399,22 +395,22 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 3 unmodified lines
399 case 0:395 case 0:
400 this_mv.col = (this_mv.col - 8) | 4;396 this_mv.col = (this_mv.col - 8) | 4;
401 this_mv.row = (this_mv.row - 8) | 4;397 this_mv.row = (this_mv.row - 8) | 4;
402 diag = svf(y - 1 - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);398 diag = vfp->svf_halfpix_hv(y - 1 - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
403 break;399 break;
404 case 1:400 case 1:
405 this_mv.col += 4;401 this_mv.col += 4;
406 this_mv.row = (this_mv.row - 8) | 4;402 this_mv.row = (this_mv.row - 8) | 4;
407 diag = svf(y - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);403 diag = vfp->svf_halfpix_hv(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
408 break;404 break;
409 case 2:405 case 2:
410 this_mv.col = (this_mv.col - 8) | 4;406 this_mv.col = (this_mv.col - 8) | 4;
411 this_mv.row += 4;407 this_mv.row += 4;
412 diag = svf(y - 1, d->pre_stride, 4, 4, z, b->src_stride, &sse);408 diag = vfp->svf_halfpix_hv(y - 1, d->pre_stride, z, b->src_stride, &sse);
413 break;409 break;
414 case 3:410 case 3:
415 this_mv.col += 4;411 this_mv.col += 4;
416 this_mv.row += 4;412 this_mv.row += 4;
417 diag = svf(y, d->pre_stride, 4, 4, z, b->src_stride, &sse);413 diag = vfp->svf_halfpix_hv(y, d->pre_stride, z, b->src_stride, &sse);
418 break;414 break;
419 }415 }
420 416
@@ -446,12 +442,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 25 unmodified lines
446 if (startmv.col & 7)442 if (startmv.col & 7)
447 {443 {
448 this_mv.col = startmv.col - 2;444 this_mv.col = startmv.col - 2;
449 left = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);445 left = vfp->svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
450 }446 }
451 else447 else
452 {448 {
453 this_mv.col = (startmv.col - 8) | 6;449 this_mv.col = (startmv.col - 8) | 6;
454 left = svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);450 left = vfp->svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);
455 }451 }
456 452
457 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);453 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
@@ -463,7 +459,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 5 unmodified lines
463 }459 }
464 460
465 this_mv.col += 4;461 this_mv.col += 4;
466 right = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);462 right = vfp->svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
467 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);463 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
468 464
469 if (right < bestmse)465 if (right < bestmse)
@@ -478,12 +474,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 8 unmodified lines
478 if (startmv.row & 7)474 if (startmv.row & 7)
479 {475 {
480 this_mv.row = startmv.row - 2;476 this_mv.row = startmv.row - 2;
481 up = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);477 up = vfp->svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
482 }478 }
483 else479 else
484 {480 {
485 this_mv.row = (startmv.row - 8) | 6;481 this_mv.row = (startmv.row - 8) | 6;
486 up = svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);482 up = vfp->svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);
487 }483 }
488 484
489 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);485 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
@@ -495,7 +491,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 5 unmodified lines
495 }491 }
496 492
497 this_mv.row += 4;493 this_mv.row += 4;
498 down = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);494 down = vfp->svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
499 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);495 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
500 496
501 if (down < bestmse)497 if (down < bestmse)
@@ -523,12 +519,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 21 unmodified lines
523 if (startmv.col & 7)519 if (startmv.col & 7)
524 {520 {
525 this_mv.col -= 2;521 this_mv.col -= 2;
526 diag = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);522 diag = vfp->svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
527 }523 }
528 else524 else
529 {525 {
530 this_mv.col = (startmv.col - 8) | 6;526 this_mv.col = (startmv.col - 8) | 6;
531 diag = svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);;527 diag = vfp->svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);;
532 }528 }
533 }529 }
534 else530 else
@@ -538,12 +534,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 3 unmodified lines
538 if (startmv.col & 7)534 if (startmv.col & 7)
539 {535 {
540 this_mv.col -= 2;536 this_mv.col -= 2;
541 diag = svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);537 diag = vfp->svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);
542 }538 }
543 else539 else
544 {540 {
545 this_mv.col = (startmv.col - 8) | 6;541 this_mv.col = (startmv.col - 8) | 6;
546 diag = svf(y - d->pre_stride - 1, d->pre_stride, 6, 6, z, b->src_stride, &sse);542 diag = vfp->svf(y - d->pre_stride - 1, d->pre_stride, 6, 6, z, b->src_stride, &sse);
547 }543 }
548 }544 }
549 545
@@ -554,12 +550,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 4 unmodified lines
554 if (startmv.row & 7)550 if (startmv.row & 7)
555 {551 {
556 this_mv.row -= 2;552 this_mv.row -= 2;
557 diag = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);553 diag = vfp->svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
558 }554 }
559 else555 else
560 {556 {
561 this_mv.row = (startmv.row - 8) | 6;557 this_mv.row = (startmv.row - 8) | 6;
562 diag = svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);558 diag = vfp->svf(y - d->pre_stride, d->pre_stride, this_mv.col & 7, 6, z, b->src_stride, &sse);
563 }559 }
564 560
565 break;561 break;
@@ -569,19 +565,19 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 3 unmodified lines
569 if (startmv.col & 7)565 if (startmv.col & 7)
570 {566 {
571 this_mv.col -= 2;567 this_mv.col -= 2;
572 diag = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);568 diag = vfp->svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
573 }569 }
574 else570 else
575 {571 {
576 this_mv.col = (startmv.col - 8) | 6;572 this_mv.col = (startmv.col - 8) | 6;
577 diag = svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);;573 diag = vfp->svf(y - 1, d->pre_stride, 6, this_mv.row & 7, z, b->src_stride, &sse);;
578 }574 }
579 575
580 break;576 break;
581 case 3:577 case 3:
582 this_mv.col += 2;578 this_mv.col += 2;
583 this_mv.row += 2;579 this_mv.row += 2;
584 diag = svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);580 diag = vfp->svf(y, d->pre_stride, this_mv.col & 7, this_mv.row & 7, z, b->src_stride, &sse);
585 break;581 break;
586 }582 }
587 583
@@ -598,7 +594,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 10 unmodified lines
598 return bestmse;594 return bestmse;
599}595}
600 596
601int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, int *mvcost[2])597int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2])
602{598{
603 int bestmse = INT_MAX;599 int bestmse = INT_MAX;
604 MV startmv;600 MV startmv;
@@ -623,13 +619,13 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 18 unmodified lines
623 startmv = *bestmv;619 startmv = *bestmv;
624 620
625 // calculate central point error621 // calculate central point error
626 bestmse = vf(y, d->pre_stride, z, b->src_stride, &sse);622 bestmse = vfp->vf(y, d->pre_stride, z, b->src_stride, &sse);
627 bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);623 bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
628 624
629 // go left then right and check error625 // go left then right and check error
630 this_mv.row = startmv.row;626 this_mv.row = startmv.row;
631 this_mv.col = ((startmv.col - 8) | 4);627 this_mv.col = ((startmv.col - 8) | 4);
632 left = svf(y - 1, d->pre_stride, 4, 0, z, b->src_stride, &sse);628 left = vfp->svf_halfpix_h(y - 1, d->pre_stride, z, b->src_stride, &sse);
633 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);629 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
634 630
635 if (left < bestmse)631 if (left < bestmse)
@@ -639,7 +635,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 3 unmodified lines
639 }635 }
640 636
641 this_mv.col += 8;637 this_mv.col += 8;
642 right = svf(y, d->pre_stride, 4, 0, z, b->src_stride, &sse);638 right = vfp->svf_halfpix_h(y, d->pre_stride, z, b->src_stride, &sse);
643 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);639 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
644 640
645 if (right < bestmse)641 if (right < bestmse)
@@ -651,7 +647,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 5 unmodified lines
651 // go up then down and check error647 // go up then down and check error
652 this_mv.col = startmv.col;648 this_mv.col = startmv.col;
653 this_mv.row = ((startmv.row - 8) | 4);649 this_mv.row = ((startmv.row - 8) | 4);
654 up = svf(y - d->pre_stride, d->pre_stride, 0, 4, z, b->src_stride, &sse);650 up = vfp->svf_halfpix_v(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
655 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);651 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
656 652
657 if (up < bestmse)653 if (up < bestmse)
@@ -661,7 +657,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 3 unmodified lines
661 }657 }
662 658
663 this_mv.row += 8;659 this_mv.row += 8;
664 down = svf(y, d->pre_stride, 0, 4, z, b->src_stride, &sse);660 down = vfp->svf_halfpix_v(y, d->pre_stride, z, b->src_stride, &sse);
665 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);661 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
666 662
667 if (down < bestmse)663 if (down < bestmse)
@@ -681,22 +677,22 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 13 unmodified lines
681 case 0:677 case 0:
682 this_mv.col = (this_mv.col - 8) | 4;678 this_mv.col = (this_mv.col - 8) | 4;
683 this_mv.row = (this_mv.row - 8) | 4;679 this_mv.row = (this_mv.row - 8) | 4;
684 diag = svf(y - 1 - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);680 diag = vfp->svf(y - 1 - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);
685 break;681 break;
686 case 1:682 case 1:
687 this_mv.col += 4;683 this_mv.col += 4;
688 this_mv.row = (this_mv.row - 8) | 4;684 this_mv.row = (this_mv.row - 8) | 4;
689 diag = svf(y - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);685 diag = vfp->svf(y - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);
690 break;686 break;
691 case 2:687 case 2:
692 this_mv.col = (this_mv.col - 8) | 4;688 this_mv.col = (this_mv.col - 8) | 4;
693 this_mv.row += 4;689 this_mv.row += 4;
694 diag = svf(y - 1, d->pre_stride, 4, 4, z, b->src_stride, &sse);690 diag = vfp->svf(y - 1, d->pre_stride, 4, 4, z, b->src_stride, &sse);
695 break;691 break;
696 case 3:692 case 3:
697 this_mv.col += 4;693 this_mv.col += 4;
698 this_mv.row += 4;694 this_mv.row += 4;
699 diag = svf(y, d->pre_stride, 4, 4, z, b->src_stride, &sse);695 diag = vfp->svf(y, d->pre_stride, 4, 4, z, b->src_stride, &sse);
700 break;696 break;
701 }697 }
702 698
@@ -711,7 +707,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 8 unmodified lines
711#else707#else
712 this_mv.col = (this_mv.col - 8) | 4;708 this_mv.col = (this_mv.col - 8) | 4;
713 this_mv.row = (this_mv.row - 8) | 4;709 this_mv.row = (this_mv.row - 8) | 4;
714 diag = svf(y - 1 - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);710 diag = vfp->svf_halfpix_hv(y - 1 - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
715 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);711 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
716 712
717 if (diag < bestmse)713 if (diag < bestmse)
@@ -721,7 +717,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 3 unmodified lines
721 }717 }
722 718
723 this_mv.col += 8;719 this_mv.col += 8;
724 diag = svf(y - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);720 diag = vfp->svf_halfpix_hv(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
725 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);721 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
726 722
727 if (diag < bestmse)723 if (diag < bestmse)
@@ -732,7 +728,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 4 unmodified lines
732 728
733 this_mv.col = (this_mv.col - 8) | 4;729 this_mv.col = (this_mv.col - 8) | 4;
734 this_mv.row = startmv.row + 4;730 this_mv.row = startmv.row + 4;
735 diag = svf(y - 1, d->pre_stride, 4, 4, z, b->src_stride, &sse);731 diag = vfp->svf_halfpix_hv(y - 1, d->pre_stride, z, b->src_stride, &sse);
736 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);732 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
737 733
738 if (diag < bestmse)734 if (diag < bestmse)
@@ -742,7 +738,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 3 unmodified lines
742 }738 }
743 739
744 this_mv.col += 8;740 this_mv.col += 8;
745 diag = svf(y, d->pre_stride, 4, 4, z, b->src_stride, &sse);741 diag = vfp->svf_halfpix_hv(y, d->pre_stride, z, b->src_stride, &sse);
746 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);742 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
747 743
748 if (diag < bestmse)744 if (diag < bestmse)
@@ -758,7 +754,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 9 unmodified lines
758 754
759#define MVC(r,c) (((mvsadcost[0][((r)<<2)-rr] + mvsadcost[1][((c)<<2) - rc]) * error_per_bit + 128 )>>8 ) // estimated cost of a motion vector (r,c)755#define MVC(r,c) (((mvsadcost[0][((r)<<2)-rr] + mvsadcost[1][((c)<<2) - rc]) * error_per_bit + 128 )>>8 ) // estimated cost of a motion vector (r,c)
760#define PRE(r,c) (*(d->base_pre) + d->pre + (r) * d->pre_stride + (c)) // pointer to predictor base of a motionvector756#define PRE(r,c) (*(d->base_pre) + d->pre + (r) * d->pre_stride + (c)) // pointer to predictor base of a motionvector
761#define DIST(r,c,v) sf( src,src_stride,PRE(r,c),d->pre_stride, v) // returns sad error score.757#define DIST(r,c,v) vfp->sdf( src,src_stride,PRE(r,c),d->pre_stride, v) // returns sad error score.
762#define ERR(r,c,v) (MVC(r,c)+DIST(r,c,v)) // returns distortion + motion vector cost758#define ERR(r,c,v) (MVC(r,c)+DIST(r,c,v)) // returns distortion + motion vector cost
763#define CHECK_BETTER(v,r,c) if ((v = ERR(r,c,besterr)) < besterr) { besterr = v; br=r; bc=c; } // checks if (r,c) has better score than previous best759#define CHECK_BETTER(v,r,c) if ((v = ERR(r,c,besterr)) < besterr) { besterr = v; br=r; bc=c; } // checks if (r,c) has better score than previous best
764static const MV next_chkpts[6][3] =760static const MV next_chkpts[6][3] =
@@ -780,8 +776,7 @@ int vp8_hex_search · 15 unmodified lines
780 int search_param,776 int search_param,
781 int error_per_bit,777 int error_per_bit,
782 int *num00,778 int *num00,
783 vp8_variance_fn_t vf,779 const vp8_variance_fn_ptr_t *vfp,
784 vp8_sad_fn_t sf,
785 int *mvsadcost[2],780 int *mvsadcost[2],
786 int *mvcost[2]781 int *mvcost[2]
787)782)
@@ -896,7 +891,7 @@ cal_neighbors: · 108 unmodified lines
896 best_mv->row = br;891 best_mv->row = br;
897 best_mv->col = bc;892 best_mv->col = bc;
898 893
899 return vf(src, src_stride, PRE(br, bc), d->pre_stride, &thiserr) + MVC(br, bc) ;894 return vfp->vf(src, src_stride, PRE(br, bc), d->pre_stride, &thiserr) + MVC(br, bc) ;
900}895}
901#undef MVC896#undef MVC
902#undef PRE897#undef PRE
vp8/encoder/mcomp.h+4−3
@@ -42,14 +42,15 @@ extern int vp8_hex_search · 41 unmodified lines
42 int search_param,42 int search_param,
43 int error_per_bit,43 int error_per_bit,
44 int *num00,44 int *num00,
45 vp8_variance_fn_t vf,45 const vp8_variance_fn_ptr_t *vf,
46 vp8_sad_fn_t sf,
47 int *mvsadcost[2],46 int *mvsadcost[2],
48 int *mvcost[2]47 int *mvcost[2]
49 48
50);49);
51 50
52typedef int (fractional_mv_step_fp)(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, int *mvcost[2]);51typedef int (fractional_mv_step_fp)
52 (MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv,
53 int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2]);
53extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively;54extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively;
54extern fractional_mv_step_fp vp8_find_best_sub_pixel_step;55extern fractional_mv_step_fp vp8_find_best_sub_pixel_step;
55extern fractional_mv_step_fp vp8_find_best_half_pixel_step;56extern fractional_mv_step_fp vp8_find_best_half_pixel_step;
vp8/encoder/onyx_if.c+44−5
@@ -2334,11 +2334,50 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) · 2333 unmodified lines
2334 2334
2335 vp8cx_create_encoder_threads(cpi);2335 vp8cx_create_encoder_threads(cpi);
2336 2336
2337 cpi->fn_ptr.sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16);2337 cpi->fn_ptr[BLOCK_16X16].sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16);
2338 cpi->fn_ptr.vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16);2338 cpi->fn_ptr[BLOCK_16X16].vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16);
2339 cpi->fn_ptr.svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar16x16);2339 cpi->fn_ptr[BLOCK_16X16].svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar16x16);
2340 cpi->fn_ptr.sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x3);2340 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_h = VARIANCE_INVOKE(&cpi->rtcd.variance, halfpixvar16x16_h);
2341 cpi->fn_ptr.sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x4d);2341 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_v = VARIANCE_INVOKE(&cpi->rtcd.variance, halfpixvar16x16_v);
2342 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_hv = VARIANCE_INVOKE(&cpi->rtcd.variance, halfpixvar16x16_hv);
2343 cpi->fn_ptr[BLOCK_16X16].sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x3);
2344 cpi->fn_ptr[BLOCK_16X16].sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x4d);
2345
2346 cpi->fn_ptr[BLOCK_16X8].sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8);
2347 cpi->fn_ptr[BLOCK_16X8].vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x8);
2348 cpi->fn_ptr[BLOCK_16X8].svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar16x8);
2349 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_h = NULL;
2350 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_v = NULL;
2351 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_hv = NULL;
2352 cpi->fn_ptr[BLOCK_16X8].sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8x3);
2353 cpi->fn_ptr[BLOCK_16X8].sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8x4d);
2354
2355 cpi->fn_ptr[BLOCK_8X16].sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16);
2356 cpi->fn_ptr[BLOCK_8X16].vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var8x16);
2357 cpi->fn_ptr[BLOCK_8X16].svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar8x16);
2358 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_h = NULL;
2359 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_v = NULL;
2360 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_hv = NULL;
2361 cpi->fn_ptr[BLOCK_8X16].sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16x3);
2362 cpi->fn_ptr[BLOCK_8X16].sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16x4d);
2363
2364 cpi->fn_ptr[BLOCK_8X8].sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8);
2365 cpi->fn_ptr[BLOCK_8X8].vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var8x8);
2366 cpi->fn_ptr[BLOCK_8X8].svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar8x8);
2367 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_h = NULL;
2368 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_v = NULL;
2369 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_hv = NULL;
2370 cpi->fn_ptr[BLOCK_8X8].sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8x3);
2371 cpi->fn_ptr[BLOCK_8X8].sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8x4d);
2372
2373 cpi->fn_ptr[BLOCK_4X4].sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4);
2374 cpi->fn_ptr[BLOCK_4X4].vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var4x4);
2375 cpi->fn_ptr[BLOCK_4X4].svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar4x4);
2376 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_h = NULL;
2377 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_v = NULL;
2378 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_hv = NULL;
2379 cpi->fn_ptr[BLOCK_4X4].sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4x3);
2380 cpi->fn_ptr[BLOCK_4X4].sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4x4d);
2342 2381
2343#if !(CONFIG_REALTIME_ONLY)2382#if !(CONFIG_REALTIME_ONLY)
2344 cpi->full_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, full_search);2383 cpi->full_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, full_search);
vp8/encoder/onyx_int.h+11−1
@@ -229,6 +229,16 @@ typedef struct VP8_ENCODER_RTCD · 228 unmodified lines
229 vp8_search_rtcd_vtable_t search;229 vp8_search_rtcd_vtable_t search;
230} VP8_ENCODER_RTCD;230} VP8_ENCODER_RTCD;
231 231
232enum
233{
234 BLOCK_16X8,
235 BLOCK_8X16,
236 BLOCK_8X8,
237 BLOCK_4X4,
238 BLOCK_16X16,
239 BLOCK_MAX_SEGMENTS
240};
241
232typedef struct242typedef struct
233{243{
234 244
@@ -591,7 +601,7 @@ typedef struct · 356 unmodified lines
591 fractional_mv_step_fp *find_fractional_mv_step;601 fractional_mv_step_fp *find_fractional_mv_step;
592 vp8_full_search_fn_t full_search_sad;602 vp8_full_search_fn_t full_search_sad;
593 vp8_diamond_search_fn_t diamond_search_sad;603 vp8_diamond_search_fn_t diamond_search_sad;
594 vp8_variance_fn_ptr_t fn_ptr;604 vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SEGMENTS];
595 unsigned int time_receive_data;605 unsigned int time_receive_data;
596 unsigned int time_compress_data;606 unsigned int time_compress_data;
597 unsigned int time_pick_lpf;607 unsigned int time_pick_lpf;
vp8/encoder/pickinter.c+10−11
@@ -50,14 +50,13 @@ extern int vp8_cost_mv_ref(MB_PREDICTION_MODE m, const int near_mv_ref_ct[4]); · 49 unmodified lines
50extern void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, MV *mv);50extern void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, MV *mv);
51 51
52 52
53int vp8_skip_fractional_mv_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, int *mvcost[2])53int vp8_skip_fractional_mv_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv, int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2])
54{54{
55 (void) b;55 (void) b;
56 (void) d;56 (void) d;
57 (void) ref_mv;57 (void) ref_mv;
58 (void) error_per_bit;58 (void) error_per_bit;
59 (void) svf;59 (void) vfp;
60 (void) vf;
61 (void) mvcost;60 (void) mvcost;
62 bestmv->row <<= 3;61 bestmv->row <<= 3;
63 bestmv->col <<= 3;62 bestmv->col <<= 3;
@@ -65,7 +64,7 @@ int vp8_skip_fractional_mv_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestmv, · 1 unmodified line
65}64}
66 65
67 66
68static int get_inter_mbpred_error(MACROBLOCK *mb, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, unsigned int *sse)67static int get_inter_mbpred_error(MACROBLOCK *mb, const vp8_variance_fn_ptr_t *vfp, unsigned int *sse)
69{68{
70 69
71 BLOCK *b = &mb->block[0];70 BLOCK *b = &mb->block[0];
@@ -81,11 +80,11 @@ static int get_inter_mbpred_error(MACROBLOCK *mb, vp8_subpixvariance_fn_t svf, v · 9 unmodified lines
81 80
82 if (xoffset | yoffset)81 if (xoffset | yoffset)
83 {82 {
84 return svf(in_what, in_what_stride, xoffset, yoffset, what, what_stride, sse);83 return vfp->svf(in_what, in_what_stride, xoffset, yoffset, what, what_stride, sse);
85 }84 }
86 else85 else
87 {86 {
88 return vf(what, what_stride, in_what, in_what_stride, sse);87 return vfp->vf(what, what_stride, in_what, in_what_stride, sse);
89 }88 }
90 89
91}90}
@@ -719,13 +718,13 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec · 627 unmodified lines
719 718
720 if (cpi->sf.search_method == HEX)719 if (cpi->sf.search_method == HEX)
721 {720 {
722 bestsme = vp8_hex_search(x, b, d, &best_ref_mv1, &d->bmi.mv.as_mv, step_param, sadpb/*x->errorperbit*/, &num00, cpi->fn_ptr.vf, cpi->fn_ptr.sdf, x->mvsadcost, x->mvcost);721 bestsme = vp8_hex_search(x, b, d, &best_ref_mv1, &d->bmi.mv.as_mv, step_param, sadpb/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost);
723 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;722 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
724 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;723 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
725 }724 }
726 else725 else
727 {726 {
728 bestsme = cpi->diamond_search_sad(x, b, d, &best_ref_mv1, &d->bmi.mv.as_mv, step_param, sadpb / 2/*x->errorperbit*/, &num00, &cpi->fn_ptr, x->mvsadcost, x->mvcost); //sadpb < 9727 bestsme = cpi->diamond_search_sad(x, b, d, &best_ref_mv1, &d->bmi.mv.as_mv, step_param, sadpb / 2/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost); //sadpb < 9
729 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;728 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
730 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;729 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
731 730
@@ -744,7 +743,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec · 12 unmodified lines
744 num00--;743 num00--;
745 else744 else
746 {745 {
747 thissme = cpi->diamond_search_sad(x, b, d, &best_ref_mv1, &d->bmi.mv.as_mv, step_param + n, sadpb / 4/*x->errorperbit*/, &num00, &cpi->fn_ptr, x->mvsadcost, x->mvcost); //sadpb = 9746 thissme = cpi->diamond_search_sad(x, b, d, &best_ref_mv1, &d->bmi.mv.as_mv, step_param + n, sadpb / 4/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost); //sadpb = 9
748 747
749 if (thissme < bestsme)748 if (thissme < bestsme)
750 {749 {
@@ -765,7 +764,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec · 14 unmodified lines
765 }764 }
766 765
767 if (bestsme < INT_MAX)766 if (bestsme < INT_MAX)
768 cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv.as_mv, &best_ref_mv1, x->errorperbit, cpi->fn_ptr.svf, cpi->fn_ptr.vf, cpi->mb.mvcost);767 cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv.as_mv, &best_ref_mv1, x->errorperbit, &cpi->fn_ptr[BLOCK_16X16], cpi->mb.mvcost);
769 768
770 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;769 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
771 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;770 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
@@ -795,7 +794,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec · 23 unmodified lines
795 x->e_mbd.block[0].bmi.mode = this_mode;794 x->e_mbd.block[0].bmi.mode = this_mode;
796 x->e_mbd.block[0].bmi.mv.as_int = x->e_mbd.mode_info_context->mbmi.mv.as_int;795 x->e_mbd.block[0].bmi.mv.as_int = x->e_mbd.mode_info_context->mbmi.mv.as_int;
797 796
798 distortion2 = get_inter_mbpred_error(x, cpi->fn_ptr.svf, cpi->fn_ptr.vf, (unsigned int *)(&sse));797 distortion2 = get_inter_mbpred_error(x, &cpi->fn_ptr[BLOCK_16X16], (unsigned int *)(&sse));
799 798
800 this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);799 this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);
801 800
vp8/encoder/rdopt.c+17−49
@@ -1130,6 +1130,8 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 1129 unmodified lines
1130 int bsd = 0;1130 int bsd = 0;
1131 int bestsegmentyrate = 0;1131 int bestsegmentyrate = 0;
1132 1132
1133 static const int segmentation_to_sseshift[4] = {3, 3, 2, 0};
1134
1133 // FIX TO Rd error outrange bug PGW 9 june 20041135 // FIX TO Rd error outrange bug PGW 9 june 2004
1134 B_PREDICTION_MODE bmodes[16] = {ZERO4X4, ZERO4X4, ZERO4X4, ZERO4X4,1136 B_PREDICTION_MODE bmodes[16] = {ZERO4X4, ZERO4X4, ZERO4X4, ZERO4X4,
1135 ZERO4X4, ZERO4X4, ZERO4X4, ZERO4X4,1137 ZERO4X4, ZERO4X4, ZERO4X4, ZERO4X4,
@@ -1151,10 +1153,10 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 15 unmodified lines
1151 int rate = 0;1153 int rate = 0;
1152 int sbr = 0;1154 int sbr = 0;
1153 int sbd = 0;1155 int sbd = 0;
1154 int UNINITIALIZED_IS_SAFE(sseshift);1156 int sseshift;
1155 int segmentyrate = 0;1157 int segmentyrate = 0;
1156 1158
1157 vp8_variance_fn_ptr_t v_fn_ptr;1159 vp8_variance_fn_ptr_t *v_fn_ptr;
1158 1160
1159 ENTROPY_CONTEXT_PLANES t_above, t_left;1161 ENTROPY_CONTEXT_PLANES t_above, t_left;
1160 ENTROPY_CONTEXT *ta;1162 ENTROPY_CONTEXT *ta;
@@ -1174,42 +1176,8 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 13 unmodified lines
1174 br = 0;1176 br = 0;
1175 bd = 0;1177 bd = 0;
1176 1178
1177 switch (segmentation)1179 v_fn_ptr = &cpi->fn_ptr[segmentation];
1178 {1180 sseshift = segmentation_to_sseshift[segmentation];
1179 case 0:
1180 v_fn_ptr.vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x8);
1181 v_fn_ptr.svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar16x8);
1182 v_fn_ptr.sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8);
1183 v_fn_ptr.sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8x3);
1184 v_fn_ptr.sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8x4d);
1185 sseshift = 3;
1186 break;
1187 case 1:
1188 v_fn_ptr.vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var8x16);
1189 v_fn_ptr.svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar8x16);
1190 v_fn_ptr.sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16);
1191 v_fn_ptr.sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16x3);
1192 v_fn_ptr.sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16x4d);
1193 sseshift = 3;
1194 break;
1195 case 2:
1196 v_fn_ptr.vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var8x8);
1197 v_fn_ptr.svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar8x8);
1198 v_fn_ptr.sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8);
1199 v_fn_ptr.sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8x3);
1200 v_fn_ptr.sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8x4d);
1201 sseshift = 2;
1202 break;
1203 case 3:
1204 v_fn_ptr.vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var4x4);
1205 v_fn_ptr.svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar4x4);
1206 v_fn_ptr.sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4);
1207 v_fn_ptr.sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4x3);
1208 v_fn_ptr.sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4x4d);
1209 sseshift = 0;
1210 break;
1211 }
1212
1213 labels = vp8_mbsplits[segmentation];1181 labels = vp8_mbsplits[segmentation];
1214 label_count = vp8_count_labels(labels);1182 label_count = vp8_count_labels(labels);
1215 1183
@@ -1281,10 +1249,10 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 65 unmodified lines
1281 int sadpb = x->sadperbit4;1249 int sadpb = x->sadperbit4;
1282 1250
1283 if (cpi->sf.search_method == HEX)1251 if (cpi->sf.search_method == HEX)
1284 bestsme = vp8_hex_search(x, c, e, best_ref_mv, &mode_mv[NEW4X4], step_param, sadpb/*x->errorperbit*/, &num00, v_fn_ptr.vf, v_fn_ptr.sdf, x->mvsadcost, mvcost);1252 bestsme = vp8_hex_search(x, c, e, best_ref_mv, &mode_mv[NEW4X4], step_param, sadpb/*x->errorperbit*/, &num00, v_fn_ptr, x->mvsadcost, mvcost);
1285 else1253 else
1286 {1254 {
1287 bestsme = cpi->diamond_search_sad(x, c, e, best_ref_mv, &mode_mv[NEW4X4], step_param, sadpb / 2/*x->errorperbit*/, &num00, &v_fn_ptr, x->mvsadcost, mvcost);1255 bestsme = cpi->diamond_search_sad(x, c, e, best_ref_mv, &mode_mv[NEW4X4], step_param, sadpb / 2/*x->errorperbit*/, &num00, v_fn_ptr, x->mvsadcost, mvcost);
1288 1256
1289 n = num00;1257 n = num00;
1290 num00 = 0;1258 num00 = 0;
@@ -1297,7 +1265,7 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 6 unmodified lines
1297 num00--;1265 num00--;
1298 else1266 else
1299 {1267 {
1300 thissme = cpi->diamond_search_sad(x, c, e, best_ref_mv, &temp_mv, step_param + n, sadpb / 2/*x->errorperbit*/, &num00, &v_fn_ptr, x->mvsadcost, mvcost);1268 thissme = cpi->diamond_search_sad(x, c, e, best_ref_mv, &temp_mv, step_param + n, sadpb / 2/*x->errorperbit*/, &num00, v_fn_ptr, x->mvsadcost, mvcost);
1301 1269
1302 if (thissme < bestsme)1270 if (thissme < bestsme)
1303 {1271 {
@@ -1312,7 +1280,7 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 8 unmodified lines
1312 // Should we do a full search (best quality only)1280 // Should we do a full search (best quality only)
1313 if ((compressor_speed == 0) && (bestsme >> sseshift) > 4000)1281 if ((compressor_speed == 0) && (bestsme >> sseshift) > 4000)
1314 {1282 {
1315 thissme = cpi->full_search_sad(x, c, e, best_ref_mv, sadpb / 4, 16, &v_fn_ptr, x->mvcost, x->mvsadcost);1283 thissme = cpi->full_search_sad(x, c, e, best_ref_mv, sadpb / 4, 16, v_fn_ptr, x->mvcost, x->mvsadcost);
1316 1284
1317 if (thissme < bestsme)1285 if (thissme < bestsme)
1318 {1286 {
@@ -1330,9 +1298,9 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 11 unmodified lines
1330 if (bestsme < INT_MAX)1298 if (bestsme < INT_MAX)
1331 {1299 {
1332 if (!fullpixel)1300 if (!fullpixel)
1333 cpi->find_fractional_mv_step(x, c, e, &mode_mv[NEW4X4], best_ref_mv, x->errorperbit / 2, v_fn_ptr.svf, v_fn_ptr.vf, mvcost);1301 cpi->find_fractional_mv_step(x, c, e, &mode_mv[NEW4X4], best_ref_mv, x->errorperbit / 2, v_fn_ptr, mvcost);
1334 else1302 else
1335 vp8_skip_fractional_mv_step(x, c, e, &mode_mv[NEW4X4], best_ref_mv, x->errorperbit, v_fn_ptr.svf, v_fn_ptr.vf, mvcost);1303 vp8_skip_fractional_mv_step(x, c, e, &mode_mv[NEW4X4], best_ref_mv, x->errorperbit, v_fn_ptr, mvcost);
1336 }1304 }
1337 }1305 }
1338 1306
@@ -1852,13 +1820,13 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int · 513 unmodified lines
1852 1820
1853 if (cpi->sf.search_method == HEX)1821 if (cpi->sf.search_method == HEX)
1854 {1822 {
1855 bestsme = vp8_hex_search(x, b, d, &best_ref_mv, &d->bmi.mv.as_mv, step_param, sadpb/*x->errorperbit*/, &num00, cpi->fn_ptr.vf, cpi->fn_ptr.sdf, x->mvsadcost, x->mvcost);1823 bestsme = vp8_hex_search(x, b, d, &best_ref_mv, &d->bmi.mv.as_mv, step_param, sadpb/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost);
1856 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;1824 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
1857 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;1825 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
1858 }1826 }
1859 else1827 else
1860 {1828 {
1861 bestsme = cpi->diamond_search_sad(x, b, d, &best_ref_mv, &d->bmi.mv.as_mv, step_param, sadpb / 2/*x->errorperbit*/, &num00, &cpi->fn_ptr, x->mvsadcost, x->mvcost); //sadpb < 91829 bestsme = cpi->diamond_search_sad(x, b, d, &best_ref_mv, &d->bmi.mv.as_mv, step_param, sadpb / 2/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost); //sadpb < 9
1862 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;1830 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
1863 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;1831 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
1864 1832
@@ -1877,7 +1845,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int · 12 unmodified lines
1877 num00--;1845 num00--;
1878 else1846 else
1879 {1847 {
1880 thissme = cpi->diamond_search_sad(x, b, d, &best_ref_mv, &d->bmi.mv.as_mv, step_param + n, sadpb / 4/*x->errorperbit*/, &num00, &cpi->fn_ptr, x->mvsadcost, x->mvcost); //sadpb = 91848 thissme = cpi->diamond_search_sad(x, b, d, &best_ref_mv, &d->bmi.mv.as_mv, step_param + n, sadpb / 4/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost); //sadpb = 9
1881 1849
1882 if (thissme < bestsme)1850 if (thissme < bestsme)
1883 {1851 {
@@ -1914,7 +1882,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int · 30 unmodified lines
1914 search_range = (search_range > cpi->sf.max_fs_radius) ? cpi->sf.max_fs_radius : search_range;1882 search_range = (search_range > cpi->sf.max_fs_radius) ? cpi->sf.max_fs_radius : search_range;
1915 {1883 {
1916 int sadpb = x->sadperbit16 >> 2;1884 int sadpb = x->sadperbit16 >> 2;
1917 thissme = cpi->full_search_sad(x, b, d, &best_ref_mv, sadpb, search_range, &cpi->fn_ptr, x->mvcost, x->mvsadcost);1885 thissme = cpi->full_search_sad(x, b, d, &best_ref_mv, sadpb, search_range, &cpi->fn_ptr[BLOCK_16X16], x->mvcost, x->mvsadcost);
1918 }1886 }
1919 1887
1920 // Barrier threshold to initiating full search1888 // Barrier threshold to initiating full search
@@ -1939,7 +1907,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int · 18 unmodified lines
1939 1907
1940 if (bestsme < INT_MAX)1908 if (bestsme < INT_MAX)
1941 // cpi->find_fractional_mv_step(x,b,d,&d->bmi.mv.as_mv,&best_ref_mv,x->errorperbit/2,cpi->fn_ptr.svf,cpi->fn_ptr.vf,x->mvcost); // normal mvc=111909 // cpi->find_fractional_mv_step(x,b,d,&d->bmi.mv.as_mv,&best_ref_mv,x->errorperbit/2,cpi->fn_ptr.svf,cpi->fn_ptr.vf,x->mvcost); // normal mvc=11
1942 cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv.as_mv, &best_ref_mv, x->errorperbit / 4, cpi->fn_ptr.svf, cpi->fn_ptr.vf, x->mvcost);1910 cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv.as_mv, &best_ref_mv, x->errorperbit / 4, &cpi->fn_ptr[BLOCK_16X16], x->mvcost);
1943 1911
1944 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;1912 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
1945 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;1913 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
vp8/encoder/temporal_filter.c+5−5
@@ -234,7 +234,7 @@ static int find_matching_mb · 233 unmodified lines
234 &best_ref_mv1, &d->bmi.mv.as_mv,234 &best_ref_mv1, &d->bmi.mv.as_mv,
235 step_param,235 step_param,
236 sadpb/*x->errorperbit*/,236 sadpb/*x->errorperbit*/,
237 &num00, cpi->fn_ptr.vf, cpi->fn_ptr.sdf,237 &num00, &cpi->fn_ptr[BLOCK_16X16],
238 mvsadcost, mvcost);238 mvsadcost, mvcost);
239 }239 }
240 else240 else
@@ -245,7 +245,7 @@ static int find_matching_mb · 4 unmodified lines
245 &best_ref_mv1, &d->bmi.mv.as_mv,245 &best_ref_mv1, &d->bmi.mv.as_mv,
246 step_param,246 step_param,
247 sadpb / 2/*x->errorperbit*/,247 sadpb / 2/*x->errorperbit*/,
248 &num00, &cpi->fn_ptr,248 &num00, &cpi->fn_ptr[BLOCK_16X16],
249 mvsadcost, mvcost); //sadpb < 9249 mvsadcost, mvcost); //sadpb < 9
250 250
251 // Further step/diamond searches as necessary251 // Further step/diamond searches as necessary
@@ -267,7 +267,7 @@ static int find_matching_mb · 15 unmodified lines
267 &best_ref_mv1, &d->bmi.mv.as_mv,267 &best_ref_mv1, &d->bmi.mv.as_mv,
268 step_param + n,268 step_param + n,
269 sadpb / 4/*x->errorperbit*/,269 sadpb / 4/*x->errorperbit*/,
270 &num00, &cpi->fn_ptr,270 &num00, &cpi->fn_ptr[BLOCK_16X16],
271 mvsadcost, mvcost); //sadpb = 9271 mvsadcost, mvcost); //sadpb = 9
272 272
273 if (thissme < bestsme)273 if (thissme < bestsme)
@@ -291,8 +291,8 @@ static int find_matching_mb · 17 unmodified lines
291 {291 {
292 bestsme = cpi->find_fractional_mv_step(x, b, d,292 bestsme = cpi->find_fractional_mv_step(x, b, d,
293 &d->bmi.mv.as_mv, &best_ref_mv1,293 &d->bmi.mv.as_mv, &best_ref_mv1,
294 x->errorperbit, cpi->fn_ptr.svf,294 x->errorperbit, &cpi->fn_ptr[BLOCK_16X16],
295 cpi->fn_ptr.vf, cpi->mb.mvcost);295 cpi->mb.mvcost);
296 }296 }
297#endif297#endif
298 298
vp8/encoder/variance.h+25−7
@@ -219,6 +219,21 @@ extern prototype_subpixvariance(vp8_variance_subpixvar16x8); · 218 unmodified lines
219#endif219#endif
220extern prototype_subpixvariance(vp8_variance_subpixvar16x16);220extern prototype_subpixvariance(vp8_variance_subpixvar16x16);
221 221
222#ifndef vp8_variance_halfpixvar16x16_h
223#define vp8_variance_halfpixvar16x16_h vp8_half_pixel_variance16x16_c
224#endif
225extern prototype_variance(vp8_variance_halfpixvar16x16_h);
226
227#ifndef vp8_variance_halfpixvar16x16_v
228#define vp8_variance_halfpixvar16x16_v vp8_half_pixel_variance16x16_c
229#endif
230extern prototype_variance(vp8_variance_halfpixvar16x16_v);
231
232#ifndef vp8_variance_halfpixvar16x16_hv
233#define vp8_variance_halfpixvar16x16_hv vp8_half_pixel_variance16x16_c
234#endif
235extern prototype_variance(vp8_variance_halfpixvar16x16_hv);
236
222#ifndef vp8_variance_subpixmse16x16237#ifndef vp8_variance_subpixmse16x16
223#define vp8_variance_subpixmse16x16 vp8_sub_pixel_mse16x16_c238#define vp8_variance_subpixmse16x16 vp8_sub_pixel_mse16x16_c
224#endif239#endif
@@ -283,6 +298,9 @@ typedef struct · 58 unmodified lines
283 vp8_subpixvariance_fn_t subpixvar8x16;298 vp8_subpixvariance_fn_t subpixvar8x16;
284 vp8_subpixvariance_fn_t subpixvar16x8;299 vp8_subpixvariance_fn_t subpixvar16x8;
285 vp8_subpixvariance_fn_t subpixvar16x16;300 vp8_subpixvariance_fn_t subpixvar16x16;
301 vp8_variance_fn_t halfpixvar16x16_h;
302 vp8_variance_fn_t halfpixvar16x16_v;
303 vp8_variance_fn_t halfpixvar16x16_hv;
286 vp8_subpixvariance_fn_t subpixmse16x16;304 vp8_subpixvariance_fn_t subpixmse16x16;
287 305
288 vp8_getmbss_fn_t getmbss;306 vp8_getmbss_fn_t getmbss;
@@ -309,11 +327,14 @@ typedef struct · 20 unmodified lines
309 327
310typedef struct328typedef struct
311{329{
312 vp8_sad_fn_t sdf;330 vp8_sad_fn_t sdf;
313 vp8_sad_multi_fn_t sdx3f;331 vp8_variance_fn_t vf;
314 vp8_sad_multi_d_fn_t sdx4df;
315 vp8_variance_fn_t vf;
316 vp8_subpixvariance_fn_t svf;332 vp8_subpixvariance_fn_t svf;
333 vp8_variance_fn_t svf_halfpix_h;
334 vp8_variance_fn_t svf_halfpix_v;
335 vp8_variance_fn_t svf_halfpix_hv;
336 vp8_sad_multi_fn_t sdx3f;
337 vp8_sad_multi_d_fn_t sdx4df;
317} vp8_variance_fn_ptr_t;338} vp8_variance_fn_ptr_t;
318 339
319#if CONFIG_RUNTIME_CPU_DETECT340#if CONFIG_RUNTIME_CPU_DETECT
@@ -322,7 +343,4 @@ typedef struct · 2 unmodified lines
322#define VARIANCE_INVOKE(ctx,fn) vp8_variance_##fn343#define VARIANCE_INVOKE(ctx,fn) vp8_variance_##fn
323#endif344#endif
324 345
325/* TODO: Determine if this USEBILINEAR flag is necessary. */
326#define USEBILINEAR
327
328#endif346#endif
vp8/encoder/variance_c.c+13−2
@@ -24,7 +24,6 @@ const int vp8_six_tap[8][6] = · 23 unmodified lines
24};24};
25 25
26 26
27#ifdef USEBILINEAR
28const int VP8_FILTER_WEIGHT = 128;27const int VP8_FILTER_WEIGHT = 128;
29const int VP8_FILTER_SHIFT = 7;28const int VP8_FILTER_SHIFT = 7;
30const int vp8_bilinear_taps[8][2] =29const int vp8_bilinear_taps[8][2] =
@@ -461,6 +460,19 @@ unsigned int vp8_sub_pixel_variance16x16_c · 430 unmodified lines
461 return vp8_variance16x16_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);460 return vp8_variance16x16_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
462}461}
463 462
463
464unsigned int vp8_half_pixel_variance16x16_c(
465 const unsigned char *src_ptr,
466 int source_stride,
467 const unsigned char *ref_ptr,
468 int recon_stride,
469 unsigned int *sse)
470{
471 return vp8_sub_pixel_variance16x16_c(src_ptr, source_stride, 4, 4,
472 ref_ptr, recon_stride, sse);
473}
474
475
464unsigned int vp8_sub_pixel_mse16x16_c476unsigned int vp8_sub_pixel_mse16x16_c
465(477(
466 const unsigned char *src_ptr,478 const unsigned char *src_ptr,
@@ -525,4 +537,3 @@ unsigned int vp8_sub_pixel_variance8x16_c · 58 unmodified lines
525 537
526 return vp8_variance8x16_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse);538 return vp8_variance8x16_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
527}539}
528#endif
vp8/vp8cx_arm.mk+0−1
@@ -19,7 +19,6 @@ VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/encodemb_arm.c · 18 unmodified lines
19VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/quantize_arm.c19VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/quantize_arm.c
20VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/picklpf_arm.c20VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/picklpf_arm.c
21VP8_CX_SRCS-$(HAVE_ARMV5TE) += encoder/arm/boolhuff_arm.c21VP8_CX_SRCS-$(HAVE_ARMV5TE) += encoder/arm/boolhuff_arm.c
22VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/mcomp_arm.c
23 22
24VP8_CX_SRCS_REMOVE-$(HAVE_ARMV5TE) += encoder/boolhuff.c23VP8_CX_SRCS_REMOVE-$(HAVE_ARMV5TE) += encoder/boolhuff.c
25 24

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t