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
20−static int mv_ref_ct [31] [4] [2];
21−static int mv_mode_cts [4] [2];
22−#endif
23−
24−extern 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−);
34−extern 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−);
42−extern 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−);
50−extern 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−
60−int 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−
345−int 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
504−void 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
560−void 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−
566−void 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
99 ;
1010
1111
12− EXPORT |vp8_sub_pixel_variance16x16s_4_0_neon|
13− EXPORT |vp8_sub_pixel_variance16x16s_0_4_neon|
14− EXPORT |vp8_sub_pixel_variance16x16s_4_4_neon|
12+ EXPORT |vp8_variance_halfpixvar16x16_h_neon|
13+ EXPORT |vp8_variance_halfpixvar16x16_v_neon|
14+ EXPORT |vp8_variance_halfpixvar16x16_hv_neon|
1515 EXPORT |vp8_sub_pixel_variance16x16s_neon|
1616 ARM
1717 REQUIRE8
@@ -20,7 +20,7 @@ · 2 unmodified lines
2020 AREA ||.text||, CODE, READONLY, ALIGN=2
2121
2222 ;================================================
23−;unsigned int vp8_sub_pixel_variance16x16s_4_0_neon
23+;unsigned int vp8_variance_halfpixvar16x16_h_neon
2424 ;(
2525 ; unsigned char *src_ptr, r0
2626 ; int src_pixels_per_line, r1
@@ -29,7 +29,7 @@ · 2 unmodified lines
2929 ; unsigned int *sse
3030 ;);
3131 ;================================================
32−|vp8_sub_pixel_variance16x16s_4_0_neon| PROC
32+|vp8_variance_halfpixvar16x16_h_neon| PROC
3333 push {lr}
3434
3535 mov r12, #4 ;loop counter
@@ -120,7 +120,7 @@ vp8_filt_fpo16x16s_4_0_loop_neon · 84 unmodified lines
120120 ENDP
121121
122122 ;================================================
123−;unsigned int vp8_sub_pixel_variance16x16s_0_4_neon
123+;unsigned int vp8_variance_halfpixvar16x16_v_neon
124124 ;(
125125 ; unsigned char *src_ptr, r0
126126 ; int src_pixels_per_line, r1
@@ -129,7 +129,7 @@ vp8_filt_fpo16x16s_4_0_loop_neon · 2 unmodified lines
129129 ; unsigned int *sse
130130 ;);
131131 ;================================================
132−|vp8_sub_pixel_variance16x16s_0_4_neon| PROC
132+|vp8_variance_halfpixvar16x16_v_neon| PROC
133133 push {lr}
134134
135135 mov r12, #4 ;loop counter
@@ -216,7 +216,7 @@ vp8_filt_spo16x16s_0_4_loop_neon · 80 unmodified lines
216216 ENDP
217217
218218 ;================================================
219−;unsigned int vp8_sub_pixel_variance16x16s_4_4_neon
219+;unsigned int vp8_variance_halfpixvar16x16_hv_neon
220220 ;(
221221 ; unsigned char *src_ptr, r0
222222 ; int src_pixels_per_line, r1
@@ -225,7 +225,7 @@ vp8_filt_spo16x16s_0_4_loop_neon · 2 unmodified lines
225225 ; unsigned int *sse
226226 ;);
227227 ;================================================
228−|vp8_sub_pixel_variance16x16s_4_4_neon| PROC
228+|vp8_variance_halfpixvar16x16_hv_neon| PROC
229229 push {lr}
230230
231231 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
3030 //extern prototype_subpixvariance(vp8_sub_pixel_variance8x16_c);
3131 //extern prototype_subpixvariance(vp8_sub_pixel_variance16x8_c);
3232 extern prototype_subpixvariance(vp8_sub_pixel_variance16x16_neon);
33+extern prototype_variance(vp8_variance_halfpixvar16x16_h_neon);
34+extern prototype_variance(vp8_variance_halfpixvar16x16_v_neon);
35+extern prototype_variance(vp8_variance_halfpixvar16x16_hv_neon);
3336
3437 //extern prototype_getmbss(vp8_get_mb_ss_c);
3538 extern prototype_variance(vp8_mse16x16_neon);
@@ -84,6 +87,15 @@ extern prototype_sad(vp8_get4x4sse_cs_neon); · 48 unmodified lines
8487 #undef vp8_variance_subpixvar16x16
8588 #define vp8_variance_subpixvar16x16 vp8_sub_pixel_variance16x16_neon
8689
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+
8799 //#undef vp8_variance_getmbss
88100 //#define vp8_variance_getmbss vp8_get_mb_ss_c
89101
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
462462 int step_param = 3; //3; // Dont search over full range for first pass
463463 int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param; //3;
464464 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];
466466 int new_mv_mode_penalty = 256;
467467
468+ // override the default variance function to use MSE
468469 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;
471470
472471 // Set up pointers for this macro block recon buffer
473472 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
186186 #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)
187187 #define PRE(r,c) (*(d->base_pre) + d->pre + ((r)>>2) * d->pre_stride + ((c)>>2)) // pointer to predictor base of a motionvector
188188 #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.
190190 #define IFMVCV(r,c,s,e) if ( c >= minc && c <= maxc && r >= minr && r <= maxr) s else e;
191191 #define ERR(r,c) (MVC(r,c)+DIST(r,c)) // returns distortion + motion vector cost
192192 #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
195195
196196 //#define CHECK_BETTER(v,r,c) if((v = ERR(r,c)) < besterr) { besterr = v; br=r; bc=c; }
197197
198−int 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])
198+int 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])
199199 {
200200 unsigned char *y = *(d->base_pre) + d->pre + (bestmv->row) * d->pre_stride + bestmv->col;
201201 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
220220 bestmv->col <<= 3;
221221
222222 // 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);
224224 besterr += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
225225
226226 // 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
309309 #undef CHECK_BETTER
310310 #undef MIN
311311 #undef MAX
312−int 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])
312+int 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])
313313 {
314314 int bestmse = INT_MAX;
315315 MV startmv;
@@ -336,13 +336,13 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 20 unmodified lines
336336 startmv = *bestmv;
337337
338338 // 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);
340340 bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
341341
342342 // go left then right and check error
343343 this_mv.row = startmv.row;
344344 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);
346346 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
347347
348348 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
352352 }
353353
354354 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);
356356 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
357357
358358 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
364364 // go up then down and check error
365365 this_mv.col = startmv.col;
366366 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);
368368 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
369369
370370 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
374374 }
375375
376376 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);
378378 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
379379
380380 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
386386
387387 // now check 1 more diagonal
388388 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;
393389 //for(whichdir =0;whichdir<4;whichdir++)
394390 //{
395391 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
399395 case 0:
400396 this_mv.col = (this_mv.col - 8) | 4;
401397 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);
403399 break;
404400 case 1:
405401 this_mv.col += 4;
406402 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);
408404 break;
409405 case 2:
410406 this_mv.col = (this_mv.col - 8) | 4;
411407 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);
413409 break;
414410 case 3:
415411 this_mv.col += 4;
416412 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);
418414 break;
419415 }
420416
@@ -446,12 +442,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 25 unmodified lines
446442 if (startmv.col & 7)
447443 {
448444 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);
450446 }
451447 else
452448 {
453449 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);
455451 }
456452
457453 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
463459 }
464460
465461 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);
467463 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
468464
469465 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
478474 if (startmv.row & 7)
479475 {
480476 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);
482478 }
483479 else
484480 {
485481 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);
487483 }
488484
489485 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
495491 }
496492
497493 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);
499495 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
500496
501497 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
523519 if (startmv.col & 7)
524520 {
525521 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);
527523 }
528524 else
529525 {
530526 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);;
532528 }
533529 }
534530 else
@@ -538,12 +534,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 3 unmodified lines
538534 if (startmv.col & 7)
539535 {
540536 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);
542538 }
543539 else
544540 {
545541 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);
547543 }
548544 }
549545
@@ -554,12 +550,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 4 unmodified lines
554550 if (startmv.row & 7)
555551 {
556552 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);
558554 }
559555 else
560556 {
561557 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);
563559 }
564560
565561 break;
@@ -569,19 +565,19 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 3 unmodified lines
569565 if (startmv.col & 7)
570566 {
571567 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);
573569 }
574570 else
575571 {
576572 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);;
578574 }
579575
580576 break;
581577 case 3:
582578 this_mv.col += 2;
583579 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);
585581 break;
586582 }
587583
@@ -598,7 +594,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 10 unmodified lines
598594 return bestmse;
599595 }
600596
601−int 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])
597+int 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])
602598 {
603599 int bestmse = INT_MAX;
604600 MV startmv;
@@ -623,13 +619,13 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 18 unmodified lines
623619 startmv = *bestmv;
624620
625621 // 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);
627623 bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
628624
629625 // go left then right and check error
630626 this_mv.row = startmv.row;
631627 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);
633629 left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
634630
635631 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
639635 }
640636
641637 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);
643639 right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
644640
645641 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
651647 // go up then down and check error
652648 this_mv.col = startmv.col;
653649 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);
655651 up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
656652
657653 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
661657 }
662658
663659 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);
665661 down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
666662
667663 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
681677 case 0:
682678 this_mv.col = (this_mv.col - 8) | 4;
683679 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);
685681 break;
686682 case 1:
687683 this_mv.col += 4;
688684 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);
690686 break;
691687 case 2:
692688 this_mv.col = (this_mv.col - 8) | 4;
693689 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);
695691 break;
696692 case 3:
697693 this_mv.col += 4;
698694 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);
700696 break;
701697 }
702698
@@ -711,7 +707,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestm · 8 unmodified lines
711707 #else
712708 this_mv.col = (this_mv.col - 8) | 4;
713709 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);
715711 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
716712
717713 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
721717 }
722718
723719 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);
725721 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
726722
727723 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
732728
733729 this_mv.col = (this_mv.col - 8) | 4;
734730 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);
736732 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
737733
738734 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
742738 }
743739
744740 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);
746742 diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
747743
748744 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
758754
759755 #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)
760756 #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.
762758 #define ERR(r,c,v) (MVC(r,c)+DIST(r,c,v)) // returns distortion + motion vector cost
763759 #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
764760 static const MV next_chkpts[6][3] =
@@ -780,8 +776,7 @@ int vp8_hex_search · 15 unmodified lines
780776 int search_param,
781777 int error_per_bit,
782778 int *num00,
783− vp8_variance_fn_t vf,
784− vp8_sad_fn_t sf,
779+ const vp8_variance_fn_ptr_t *vfp,
785780 int *mvsadcost[2],
786781 int *mvcost[2]
787782 )
@@ -896,7 +891,7 @@ cal_neighbors: · 108 unmodified lines
896891 best_mv->row = br;
897892 best_mv->col = bc;
898893
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) ;
900895 }
901896 #undef MVC
902897 #undef PRE
vp8/encoder/mcomp.h+4−3
@@ -42,14 +42,15 @@ extern int vp8_hex_search · 41 unmodified lines
4242 int search_param,
4343 int error_per_bit,
4444 int *num00,
45− vp8_variance_fn_t vf,
46− vp8_sad_fn_t sf,
45+ const vp8_variance_fn_ptr_t *vf,
4746 int *mvsadcost[2],
4847 int *mvcost[2]
4948
5049 );
5150
52−typedef 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]);
51+typedef 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]);
5354 extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively;
5455 extern fractional_mv_step_fp vp8_find_best_sub_pixel_step;
5556 extern 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
23342334
23352335 vp8cx_create_encoder_threads(cpi);
23362336
2337− cpi->fn_ptr.sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16);
2338− cpi->fn_ptr.vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16);
2339− cpi->fn_ptr.svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar16x16);
2340− cpi->fn_ptr.sdx3f = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x3);
2341− cpi->fn_ptr.sdx4df = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x4d);
2337+ cpi->fn_ptr[BLOCK_16X16].sdf = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16);
2338+ cpi->fn_ptr[BLOCK_16X16].vf = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16);
2339+ cpi->fn_ptr[BLOCK_16X16].svf = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar16x16);
2340+ cpi->fn_ptr[BLOCK_16X16].svf_halfpix_h = VARIANCE_INVOKE(&cpi->rtcd.variance, halfpixvar16x16_h);
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);
23422381
23432382 #if !(CONFIG_REALTIME_ONLY)
23442383 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
229229 vp8_search_rtcd_vtable_t search;
230230 } VP8_ENCODER_RTCD;
231231
232+enum
233+{
234+ BLOCK_16X8,
235+ BLOCK_8X16,
236+ BLOCK_8X8,
237+ BLOCK_4X4,
238+ BLOCK_16X16,
239+ BLOCK_MAX_SEGMENTS
240+};
241+
232242 typedef struct
233243 {
234244
@@ -591,7 +601,7 @@ typedef struct · 356 unmodified lines
591601 fractional_mv_step_fp *find_fractional_mv_step;
592602 vp8_full_search_fn_t full_search_sad;
593603 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];
595605 unsigned int time_receive_data;
596606 unsigned int time_compress_data;
597607 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
5050 extern void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, MV *mv);
5151
5252
53−int 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])
53+int 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])
5454 {
5555 (void) b;
5656 (void) d;
5757 (void) ref_mv;
5858 (void) error_per_bit;
59− (void) svf;
60− (void) vf;
59+ (void) vfp;
6160 (void) mvcost;
6261 bestmv->row <<= 3;
6362 bestmv->col <<= 3;
@@ -65,7 +64,7 @@ int vp8_skip_fractional_mv_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d, MV *bestmv, · 1 unmodified line
6564 }
6665
6766
68−static int get_inter_mbpred_error(MACROBLOCK *mb, vp8_subpixvariance_fn_t svf, vp8_variance_fn_t vf, unsigned int *sse)
67+static int get_inter_mbpred_error(MACROBLOCK *mb, const vp8_variance_fn_ptr_t *vfp, unsigned int *sse)
6968 {
7069
7170 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
8180
8281 if (xoffset | yoffset)
8382 {
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);
8584 }
8685 else
8786 {
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);
8988 }
9089
9190 }
@@ -719,13 +718,13 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec · 627 unmodified lines
719718
720719 if (cpi->sf.search_method == HEX)
721720 {
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);
723722 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
724723 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
725724 }
726725 else
727726 {
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 < 9
727+ 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
729728 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
730729 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
731730
@@ -744,7 +743,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec · 12 unmodified lines
744743 num00--;
745744 else
746745 {
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 = 9
746+ 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
748747
749748 if (thissme < bestsme)
750749 {
@@ -765,7 +764,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec · 14 unmodified lines
765764 }
766765
767766 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);
769768
770769 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
771770 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
795794 x->e_mbd.block[0].bmi.mode = this_mode;
796795 x->e_mbd.block[0].bmi.mv.as_int = x->e_mbd.mode_info_context->mbmi.mv.as_int;
797796
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));
799798
800799 this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);
801800
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
11301130 int bsd = 0;
11311131 int bestsegmentyrate = 0;
11321132
1133+ static const int segmentation_to_sseshift[4] = {3, 3, 2, 0};
1134+
11331135 // FIX TO Rd error outrange bug PGW 9 june 2004
11341136 B_PREDICTION_MODE bmodes[16] = {ZERO4X4, ZERO4X4, ZERO4X4, ZERO4X4,
11351137 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
11511153 int rate = 0;
11521154 int sbr = 0;
11531155 int sbd = 0;
1154− int UNINITIALIZED_IS_SAFE(sseshift);
1156+ int sseshift;
11551157 int segmentyrate = 0;
11561158
1157− vp8_variance_fn_ptr_t v_fn_ptr;
1159+ vp8_variance_fn_ptr_t *v_fn_ptr;
11581160
11591161 ENTROPY_CONTEXT_PLANES t_above, t_left;
11601162 ENTROPY_CONTEXT *ta;
@@ -1174,42 +1176,8 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 13 unmodified lines
11741176 br = 0;
11751177 bd = 0;
11761178
1177− switch (segmentation)
1178− {
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−
1179+ v_fn_ptr = &cpi->fn_ptr[segmentation];
1180+ sseshift = segmentation_to_sseshift[segmentation];
12131181 labels = vp8_mbsplits[segmentation];
12141182 label_count = vp8_count_labels(labels);
12151183
@@ -1281,10 +1249,10 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 65 unmodified lines
12811249 int sadpb = x->sadperbit4;
12821250
12831251 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);
12851253 else
12861254 {
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);
12881256
12891257 n = num00;
12901258 num00 = 0;
@@ -1297,7 +1265,7 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 6 unmodified lines
12971265 num00--;
12981266 else
12991267 {
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);
13011269
13021270 if (thissme < bestsme)
13031271 {
@@ -1312,7 +1280,7 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 8 unmodified lines
13121280 // Should we do a full search (best quality only)
13131281 if ((compressor_speed == 0) && (bestsme >> sseshift) > 4000)
13141282 {
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);
13161284
13171285 if (thissme < bestsme)
13181286 {
@@ -1330,9 +1298,9 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 11 unmodified lines
13301298 if (bestsme < INT_MAX)
13311299 {
13321300 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);
13341302 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);
13361304 }
13371305 }
13381306
@@ -1852,13 +1820,13 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int · 513 unmodified lines
18521820
18531821 if (cpi->sf.search_method == HEX)
18541822 {
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);
18561824 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
18571825 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
18581826 }
18591827 else
18601828 {
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 < 9
1829+ 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
18621830 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
18631831 mode_mv[NEWMV].col = d->bmi.mv.as_mv.col;
18641832
@@ -1877,7 +1845,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int · 12 unmodified lines
18771845 num00--;
18781846 else
18791847 {
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 = 9
1848+ 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
18811849
18821850 if (thissme < bestsme)
18831851 {
@@ -1914,7 +1882,7 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int · 30 unmodified lines
19141882 search_range = (search_range > cpi->sf.max_fs_radius) ? cpi->sf.max_fs_radius : search_range;
19151883 {
19161884 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);
19181886 }
19191887
19201888 // 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
19391907
19401908 if (bestsme < INT_MAX)
19411909 // 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);
19431911
19441912 mode_mv[NEWMV].row = d->bmi.mv.as_mv.row;
19451913 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
234234 &best_ref_mv1, &d->bmi.mv.as_mv,
235235 step_param,
236236 sadpb/*x->errorperbit*/,
237− &num00, cpi->fn_ptr.vf, cpi->fn_ptr.sdf,
237+ &num00, &cpi->fn_ptr[BLOCK_16X16],
238238 mvsadcost, mvcost);
239239 }
240240 else
@@ -245,7 +245,7 @@ static int find_matching_mb · 4 unmodified lines
245245 &best_ref_mv1, &d->bmi.mv.as_mv,
246246 step_param,
247247 sadpb / 2/*x->errorperbit*/,
248− &num00, &cpi->fn_ptr,
248+ &num00, &cpi->fn_ptr[BLOCK_16X16],
249249 mvsadcost, mvcost); //sadpb < 9
250250
251251 // Further step/diamond searches as necessary
@@ -267,7 +267,7 @@ static int find_matching_mb · 15 unmodified lines
267267 &best_ref_mv1, &d->bmi.mv.as_mv,
268268 step_param + n,
269269 sadpb / 4/*x->errorperbit*/,
270− &num00, &cpi->fn_ptr,
270+ &num00, &cpi->fn_ptr[BLOCK_16X16],
271271 mvsadcost, mvcost); //sadpb = 9
272272
273273 if (thissme < bestsme)
@@ -291,8 +291,8 @@ static int find_matching_mb · 17 unmodified lines
291291 {
292292 bestsme = cpi->find_fractional_mv_step(x, b, d,
293293 &d->bmi.mv.as_mv, &best_ref_mv1,
294− x->errorperbit, cpi->fn_ptr.svf,
295− cpi->fn_ptr.vf, cpi->mb.mvcost);
294+ x->errorperbit, &cpi->fn_ptr[BLOCK_16X16],
295+ cpi->mb.mvcost);
296296 }
297297 #endif
298298
vp8/encoder/variance.h+25−7
@@ -219,6 +219,21 @@ extern prototype_subpixvariance(vp8_variance_subpixvar16x8); · 218 unmodified lines
219219 #endif
220220 extern prototype_subpixvariance(vp8_variance_subpixvar16x16);
221221
222+#ifndef vp8_variance_halfpixvar16x16_h
223+#define vp8_variance_halfpixvar16x16_h vp8_half_pixel_variance16x16_c
224+#endif
225+extern 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
230+extern 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
235+extern prototype_variance(vp8_variance_halfpixvar16x16_hv);
236+
222237 #ifndef vp8_variance_subpixmse16x16
223238 #define vp8_variance_subpixmse16x16 vp8_sub_pixel_mse16x16_c
224239 #endif
@@ -283,6 +298,9 @@ typedef struct · 58 unmodified lines
283298 vp8_subpixvariance_fn_t subpixvar8x16;
284299 vp8_subpixvariance_fn_t subpixvar16x8;
285300 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;
286304 vp8_subpixvariance_fn_t subpixmse16x16;
287305
288306 vp8_getmbss_fn_t getmbss;
@@ -309,11 +327,14 @@ typedef struct · 20 unmodified lines
309327
310328 typedef struct
311329 {
312− vp8_sad_fn_t sdf;
313− vp8_sad_multi_fn_t sdx3f;
314− vp8_sad_multi_d_fn_t sdx4df;
315− vp8_variance_fn_t vf;
330+ vp8_sad_fn_t sdf;
331+ vp8_variance_fn_t vf;
316332 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;
317338 } vp8_variance_fn_ptr_t;
318339
319340 #if CONFIG_RUNTIME_CPU_DETECT
@@ -322,7 +343,4 @@ typedef struct · 2 unmodified lines
322343 #define VARIANCE_INVOKE(ctx,fn) vp8_variance_##fn
323344 #endif
324345
325−/* TODO: Determine if this USEBILINEAR flag is necessary. */
326−#define USEBILINEAR
327−
328346 #endif
vp8/encoder/variance_c.c+13−2
@@ -24,7 +24,6 @@ const int vp8_six_tap[8][6] = · 23 unmodified lines
2424 };
2525
2626
27−#ifdef USEBILINEAR
2827 const int VP8_FILTER_WEIGHT = 128;
2928 const int VP8_FILTER_SHIFT = 7;
3029 const int vp8_bilinear_taps[8][2] =
@@ -461,6 +460,19 @@ unsigned int vp8_sub_pixel_variance16x16_c · 430 unmodified lines
461460 return vp8_variance16x16_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
462461 }
463462
463+
464+unsigned 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+
464476 unsigned int vp8_sub_pixel_mse16x16_c
465477 (
466478 const unsigned char *src_ptr,
@@ -525,4 +537,3 @@ unsigned int vp8_sub_pixel_variance8x16_c · 58 unmodified lines
525537
526538 return vp8_variance8x16_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
527539 }
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
1919 VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/quantize_arm.c
2020 VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/picklpf_arm.c
2121 VP8_CX_SRCS-$(HAVE_ARMV5TE) += encoder/arm/boolhuff_arm.c
22−VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/mcomp_arm.c
2322
2423 VP8_CX_SRCS_REMOVE-$(HAVE_ARMV5TE) += encoder/boolhuff.c
2524

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