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.
Unified · Split
| @@ -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 | |
| @@ -9,9 +9,9 @@ · 8 unmodified lines | ||
| 9 | 9 | ; |
| 10 | 10 | |
| 11 | 11 | |
| 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| | |
| 15 | 15 | EXPORT |vp8_sub_pixel_variance16x16s_neon| |
| 16 | 16 | ARM |
| 17 | 17 | REQUIRE8 |
| @@ -20,7 +20,7 @@ · 2 unmodified lines | ||
| 20 | 20 | AREA ||.text||, CODE, READONLY, ALIGN=2 |
| 21 | 21 | |
| 22 | 22 | ;================================================ |
| 23 | −;unsigned int vp8_sub_pixel_variance16x16s_4_0_neon | |
| 23 | +;unsigned int vp8_variance_halfpixvar16x16_h_neon | |
| 24 | 24 | ;( |
| 25 | 25 | ; unsigned char *src_ptr, r0 |
| 26 | 26 | ; int src_pixels_per_line, r1 |
| @@ -29,7 +29,7 @@ · 2 unmodified lines | ||
| 29 | 29 | ; unsigned int *sse |
| 30 | 30 | ;); |
| 31 | 31 | ;================================================ |
| 32 | −|vp8_sub_pixel_variance16x16s_4_0_neon| PROC | |
| 32 | +|vp8_variance_halfpixvar16x16_h_neon| PROC | |
| 33 | 33 | push {lr} |
| 34 | 34 | |
| 35 | 35 | mov r12, #4 ;loop counter |
| @@ -120,7 +120,7 @@ vp8_filt_fpo16x16s_4_0_loop_neon · 84 unmodified lines | ||
| 120 | 120 | ENDP |
| 121 | 121 | |
| 122 | 122 | ;================================================ |
| 123 | −;unsigned int vp8_sub_pixel_variance16x16s_0_4_neon | |
| 123 | +;unsigned int vp8_variance_halfpixvar16x16_v_neon | |
| 124 | 124 | ;( |
| 125 | 125 | ; unsigned char *src_ptr, r0 |
| 126 | 126 | ; int src_pixels_per_line, r1 |
| @@ -129,7 +129,7 @@ vp8_filt_fpo16x16s_4_0_loop_neon · 2 unmodified lines | ||
| 129 | 129 | ; unsigned int *sse |
| 130 | 130 | ;); |
| 131 | 131 | ;================================================ |
| 132 | −|vp8_sub_pixel_variance16x16s_0_4_neon| PROC | |
| 132 | +|vp8_variance_halfpixvar16x16_v_neon| PROC | |
| 133 | 133 | push {lr} |
| 134 | 134 | |
| 135 | 135 | mov r12, #4 ;loop counter |
| @@ -216,7 +216,7 @@ vp8_filt_spo16x16s_0_4_loop_neon · 80 unmodified lines | ||
| 216 | 216 | ENDP |
| 217 | 217 | |
| 218 | 218 | ;================================================ |
| 219 | −;unsigned int vp8_sub_pixel_variance16x16s_4_4_neon | |
| 219 | +;unsigned int vp8_variance_halfpixvar16x16_hv_neon | |
| 220 | 220 | ;( |
| 221 | 221 | ; unsigned char *src_ptr, r0 |
| 222 | 222 | ; int src_pixels_per_line, r1 |
| @@ -225,7 +225,7 @@ vp8_filt_spo16x16s_0_4_loop_neon · 2 unmodified lines | ||
| 225 | 225 | ; unsigned int *sse |
| 226 | 226 | ;); |
| 227 | 227 | ;================================================ |
| 228 | −|vp8_sub_pixel_variance16x16s_4_4_neon| PROC | |
| 228 | +|vp8_variance_halfpixvar16x16_hv_neon| PROC | |
| 229 | 229 | push {lr} |
| 230 | 230 | |
| 231 | 231 | vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data |
| @@ -30,6 +30,9 @@ extern prototype_subpixvariance(vp8_sub_pixel_variance8x8_neon); · 29 unmodified lines | ||
| 30 | 30 | //extern prototype_subpixvariance(vp8_sub_pixel_variance8x16_c); |
| 31 | 31 | //extern prototype_subpixvariance(vp8_sub_pixel_variance16x8_c); |
| 32 | 32 | 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); | |
| 33 | 36 | |
| 34 | 37 | //extern prototype_getmbss(vp8_get_mb_ss_c); |
| 35 | 38 | extern prototype_variance(vp8_mse16x16_neon); |
| @@ -84,6 +87,15 @@ extern prototype_sad(vp8_get4x4sse_cs_neon); · 48 unmodified lines | ||
| 84 | 87 | #undef vp8_variance_subpixvar16x16 |
| 85 | 88 | #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 | 99 | //#undef vp8_variance_getmbss |
| 88 | 100 | //#define vp8_variance_getmbss vp8_get_mb_ss_c |
| 89 | 101 | |
| @@ -462,12 +462,11 @@ void vp8_first_pass_motion_search(VP8_COMP *cpi, MACROBLOCK *x, MV *ref_mv, MV * · 461 unmodified lines | ||
| 462 | 462 | int step_param = 3; //3; // Dont search over full range for first pass |
| 463 | 463 | int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param; //3; |
| 464 | 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 | 466 | int new_mv_mode_penalty = 256; |
| 467 | 467 | |
| 468 | + // override the default variance function to use MSE | |
| 468 | 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 | 471 | // Set up pointers for this macro block recon buffer |
| 473 | 472 | xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset; |
| @@ -186,7 +186,7 @@ void vp8_init3smotion_compensation(MACROBLOCK *x, int stride) · 185 unmodified lines | ||
| 186 | 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 | 187 | #define PRE(r,c) (*(d->base_pre) + d->pre + ((r)>>2) * d->pre_stride + ((c)>>2)) // pointer to predictor base of a motionvector |
| 188 | 188 | #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 | 190 | #define IFMVCV(r,c,s,e) if ( c >= minc && c <= maxc && r >= minr && r <= maxr) s else e; |
| 191 | 191 | #define ERR(r,c) (MVC(r,c)+DIST(r,c)) // returns distortion + motion vector cost |
| 192 | 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 best |
| @@ -195,7 +195,7 @@ void vp8_init3smotion_compensation(MACROBLOCK *x, int stride) · 2 unmodified lines | ||
| 195 | 195 | |
| 196 | 196 | //#define CHECK_BETTER(v,r,c) if((v = ERR(r,c)) < besterr) { besterr = v; br=r; bc=c; } |
| 197 | 197 | |
| 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]) | |
| 199 | 199 | { |
| 200 | 200 | unsigned char *y = *(d->base_pre) + d->pre + (bestmv->row) * d->pre_stride + bestmv->col; |
| 201 | 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 | 220 | bestmv->col <<= 3; |
| 221 | 221 | |
| 222 | 222 | // 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 | 224 | besterr += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit); |
| 225 | 225 | |
| 226 | 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 | 309 | #undef CHECK_BETTER |
| 310 | 310 | #undef MIN |
| 311 | 311 | #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]) | |
| 313 | 313 | { |
| 314 | 314 | int bestmse = INT_MAX; |
| 315 | 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 | 336 | startmv = *bestmv; |
| 337 | 337 | |
| 338 | 338 | // 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 | 340 | bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit); |
| 341 | 341 | |
| 342 | 342 | // go left then right and check error |
| 343 | 343 | this_mv.row = startmv.row; |
| 344 | 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 | 346 | left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 347 | 347 | |
| 348 | 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 | 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 | 356 | right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 357 | 357 | |
| 358 | 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 | 364 | // go up then down and check error |
| 365 | 365 | this_mv.col = startmv.col; |
| 366 | 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 | 368 | up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 369 | 369 | |
| 370 | 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 | 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 | 378 | down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 379 | 379 | |
| 380 | 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 | 387 | // now check 1 more diagonal |
| 388 | 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 | 389 | //for(whichdir =0;whichdir<4;whichdir++) |
| 394 | 390 | //{ |
| 395 | 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 | 395 | case 0: |
| 400 | 396 | this_mv.col = (this_mv.col - 8) | 4; |
| 401 | 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 | 399 | break; |
| 404 | 400 | case 1: |
| 405 | 401 | this_mv.col += 4; |
| 406 | 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 | 404 | break; |
| 409 | 405 | case 2: |
| 410 | 406 | this_mv.col = (this_mv.col - 8) | 4; |
| 411 | 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 | 409 | break; |
| 414 | 410 | case 3: |
| 415 | 411 | this_mv.col += 4; |
| 416 | 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 | 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 | 442 | if (startmv.col & 7) |
| 447 | 443 | { |
| 448 | 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 | 447 | else |
| 452 | 448 | { |
| 453 | 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 | 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 | 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 | 463 | right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 468 | 464 | |
| 469 | 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 | 474 | if (startmv.row & 7) |
| 479 | 475 | { |
| 480 | 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 | 479 | else |
| 484 | 480 | { |
| 485 | 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 | 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 | 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 | 495 | down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 500 | 496 | |
| 501 | 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 | 519 | if (startmv.col & 7) |
| 524 | 520 | { |
| 525 | 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 | 524 | else |
| 529 | 525 | { |
| 530 | 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 | 530 | else |
| @@ -538,12 +534,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, · 3 unmodified lines | ||
| 538 | 534 | if (startmv.col & 7) |
| 539 | 535 | { |
| 540 | 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 | 539 | else |
| 544 | 540 | { |
| 545 | 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 | 550 | if (startmv.row & 7) |
| 555 | 551 | { |
| 556 | 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 | 555 | else |
| 560 | 556 | { |
| 561 | 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 | 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 | 565 | if (startmv.col & 7) |
| 570 | 566 | { |
| 571 | 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 | 570 | else |
| 575 | 571 | { |
| 576 | 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 | 576 | break; |
| 581 | 577 | case 3: |
| 582 | 578 | this_mv.col += 2; |
| 583 | 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 | 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 | 594 | return bestmse; |
| 599 | 595 | } |
| 600 | 596 | |
| 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]) | |
| 602 | 598 | { |
| 603 | 599 | int bestmse = INT_MAX; |
| 604 | 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 | 619 | startmv = *bestmv; |
| 624 | 620 | |
| 625 | 621 | // 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 | 623 | bestmse += vp8_mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit); |
| 628 | 624 | |
| 629 | 625 | // go left then right and check error |
| 630 | 626 | this_mv.row = startmv.row; |
| 631 | 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 | 629 | left += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 634 | 630 | |
| 635 | 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 | 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 | 639 | right += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 644 | 640 | |
| 645 | 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 | 647 | // go up then down and check error |
| 652 | 648 | this_mv.col = startmv.col; |
| 653 | 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 | 651 | up += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 656 | 652 | |
| 657 | 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 | 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 | 661 | down += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 666 | 662 | |
| 667 | 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 | 677 | case 0: |
| 682 | 678 | this_mv.col = (this_mv.col - 8) | 4; |
| 683 | 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 | 681 | break; |
| 686 | 682 | case 1: |
| 687 | 683 | this_mv.col += 4; |
| 688 | 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 | 686 | break; |
| 691 | 687 | case 2: |
| 692 | 688 | this_mv.col = (this_mv.col - 8) | 4; |
| 693 | 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 | 691 | break; |
| 696 | 692 | case 3: |
| 697 | 693 | this_mv.col += 4; |
| 698 | 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 | 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 | 707 | #else |
| 712 | 708 | this_mv.col = (this_mv.col - 8) | 4; |
| 713 | 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 | 711 | diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 716 | 712 | |
| 717 | 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 | 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 | 721 | diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 726 | 722 | |
| 727 | 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 | 729 | this_mv.col = (this_mv.col - 8) | 4; |
| 734 | 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 | 732 | diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 737 | 733 | |
| 738 | 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 | 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 | 742 | diag += vp8_mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit); |
| 747 | 743 | |
| 748 | 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 | 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 | 756 | #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 | 758 | #define ERR(r,c,v) (MVC(r,c)+DIST(r,c,v)) // returns distortion + motion vector cost |
| 763 | 759 | #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 |
| 764 | 760 | static const MV next_chkpts[6][3] = |
| @@ -780,8 +776,7 @@ int vp8_hex_search · 15 unmodified lines | ||
| 780 | 776 | int search_param, |
| 781 | 777 | int error_per_bit, |
| 782 | 778 | int *num00, |
| 783 | − vp8_variance_fn_t vf, | |
| 784 | − vp8_sad_fn_t sf, | |
| 779 | + const vp8_variance_fn_ptr_t *vfp, | |
| 785 | 780 | int *mvsadcost[2], |
| 786 | 781 | int *mvcost[2] |
| 787 | 782 | ) |
| @@ -896,7 +891,7 @@ cal_neighbors: · 108 unmodified lines | ||
| 896 | 891 | best_mv->row = br; |
| 897 | 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 | 896 | #undef MVC |
| 902 | 897 | #undef PRE |
| @@ -42,14 +42,15 @@ extern int vp8_hex_search · 41 unmodified lines | ||
| 42 | 42 | int search_param, |
| 43 | 43 | int error_per_bit, |
| 44 | 44 | int *num00, |
| 45 | − vp8_variance_fn_t vf, | |
| 46 | − vp8_sad_fn_t sf, | |
| 45 | + const vp8_variance_fn_ptr_t *vf, | |
| 47 | 46 | int *mvsadcost[2], |
| 48 | 47 | int *mvcost[2] |
| 49 | 48 | |
| 50 | 49 | ); |
| 51 | 50 | |
| 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]); | |
| 53 | 54 | extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively; |
| 54 | 55 | extern fractional_mv_step_fp vp8_find_best_sub_pixel_step; |
| 55 | 56 | extern fractional_mv_step_fp vp8_find_best_half_pixel_step; |
| @@ -2334,11 +2334,50 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) · 2333 unmodified lines | ||
| 2334 | 2334 | |
| 2335 | 2335 | vp8cx_create_encoder_threads(cpi); |
| 2336 | 2336 | |
| 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); | |
| 2342 | 2381 | |
| 2343 | 2382 | #if !(CONFIG_REALTIME_ONLY) |
| 2344 | 2383 | cpi->full_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, full_search); |
| @@ -229,6 +229,16 @@ typedef struct VP8_ENCODER_RTCD · 228 unmodified lines | ||
| 229 | 229 | vp8_search_rtcd_vtable_t search; |
| 230 | 230 | } VP8_ENCODER_RTCD; |
| 231 | 231 | |
| 232 | +enum | |
| 233 | +{ | |
| 234 | + BLOCK_16X8, | |
| 235 | + BLOCK_8X16, | |
| 236 | + BLOCK_8X8, | |
| 237 | + BLOCK_4X4, | |
| 238 | + BLOCK_16X16, | |
| 239 | + BLOCK_MAX_SEGMENTS | |
| 240 | +}; | |
| 241 | + | |
| 232 | 242 | typedef struct |
| 233 | 243 | { |
| 234 | 244 | |
| @@ -591,7 +601,7 @@ typedef struct · 356 unmodified lines | ||
| 591 | 601 | fractional_mv_step_fp *find_fractional_mv_step; |
| 592 | 602 | vp8_full_search_fn_t full_search_sad; |
| 593 | 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 | 605 | unsigned int time_receive_data; |
| 596 | 606 | unsigned int time_compress_data; |
| 597 | 607 | unsigned int time_pick_lpf; |
| @@ -50,14 +50,13 @@ extern int vp8_cost_mv_ref(MB_PREDICTION_MODE m, const int near_mv_ref_ct[4]); · 49 unmodified lines | ||
| 50 | 50 | extern void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, MV *mv); |
| 51 | 51 | |
| 52 | 52 | |
| 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]) | |
| 54 | 54 | { |
| 55 | 55 | (void) b; |
| 56 | 56 | (void) d; |
| 57 | 57 | (void) ref_mv; |
| 58 | 58 | (void) error_per_bit; |
| 59 | − (void) svf; | |
| 60 | − (void) vf; | |
| 59 | + (void) vfp; | |
| 61 | 60 | (void) mvcost; |
| 62 | 61 | bestmv->row <<= 3; |
| 63 | 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 | |
| 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) | |
| 69 | 68 | { |
| 70 | 69 | |
| 71 | 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 | 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 | 85 | 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 | 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 | 722 | mode_mv[NEWMV].row = d->bmi.mv.as_mv.row; |
| 724 | 723 | mode_mv[NEWMV].col = d->bmi.mv.as_mv.col; |
| 725 | 724 | } |
| 726 | 725 | 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 < 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 | |
| 729 | 728 | mode_mv[NEWMV].row = d->bmi.mv.as_mv.row; |
| 730 | 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 | 743 | num00--; |
| 745 | 744 | 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 = 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 | |
| 748 | 747 | |
| 749 | 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 | 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 | 769 | mode_mv[NEWMV].row = d->bmi.mv.as_mv.row; |
| 771 | 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 | 794 | x->e_mbd.block[0].bmi.mode = this_mode; |
| 796 | 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 | 799 | this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2); |
| 801 | 800 | |
| @@ -1130,6 +1130,8 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes · 1129 unmodified lines | ||
| 1130 | 1130 | int bsd = 0; |
| 1131 | 1131 | int bestsegmentyrate = 0; |
| 1132 | 1132 | |
| 1133 | + static const int segmentation_to_sseshift[4] = {3, 3, 2, 0}; | |
| 1134 | + | |
| 1133 | 1135 | // FIX TO Rd error outrange bug PGW 9 june 2004 |
| 1134 | 1136 | B_PREDICTION_MODE bmodes[16] = {ZERO4X4, ZERO4X4, ZERO4X4, ZERO4X4, |
| 1135 | 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 | 1153 | int rate = 0; |
| 1152 | 1154 | int sbr = 0; |
| 1153 | 1155 | int sbd = 0; |
| 1154 | − int UNINITIALIZED_IS_SAFE(sseshift); | |
| 1156 | + int sseshift; | |
| 1155 | 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 | 1161 | ENTROPY_CONTEXT_PLANES t_above, t_left; |
| 1160 | 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 | 1176 | br = 0; |
| 1175 | 1177 | bd = 0; |
| 1176 | 1178 | |
| 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]; | |
| 1213 | 1181 | labels = vp8_mbsplits[segmentation]; |
| 1214 | 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 | 1249 | int sadpb = x->sadperbit4; |
| 1282 | 1250 | |
| 1283 | 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 | 1253 | 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 | 1257 | n = num00; |
| 1290 | 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 | 1265 | num00--; |
| 1298 | 1266 | 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 | 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 | 1280 | // Should we do a full search (best quality only) |
| 1313 | 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 | 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 | 1298 | if (bestsme < INT_MAX) |
| 1331 | 1299 | { |
| 1332 | 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 | 1302 | 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 | 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 | 1824 | mode_mv[NEWMV].row = d->bmi.mv.as_mv.row; |
| 1857 | 1825 | mode_mv[NEWMV].col = d->bmi.mv.as_mv.col; |
| 1858 | 1826 | } |
| 1859 | 1827 | 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 < 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 | |
| 1862 | 1830 | mode_mv[NEWMV].row = d->bmi.mv.as_mv.row; |
| 1863 | 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 | 1845 | num00--; |
| 1878 | 1846 | 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 = 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 | |
| 1881 | 1849 | |
| 1882 | 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 | 1882 | search_range = (search_range > cpi->sf.max_fs_radius) ? cpi->sf.max_fs_radius : search_range; |
| 1915 | 1883 | { |
| 1916 | 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 | 1888 | // 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 | 1908 | if (bestsme < INT_MAX) |
| 1941 | 1909 | // 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 | 1912 | mode_mv[NEWMV].row = d->bmi.mv.as_mv.row; |
| 1945 | 1913 | mode_mv[NEWMV].col = d->bmi.mv.as_mv.col; |
| @@ -234,7 +234,7 @@ static int find_matching_mb · 233 unmodified lines | ||
| 234 | 234 | &best_ref_mv1, &d->bmi.mv.as_mv, |
| 235 | 235 | step_param, |
| 236 | 236 | sadpb/*x->errorperbit*/, |
| 237 | − &num00, cpi->fn_ptr.vf, cpi->fn_ptr.sdf, | |
| 237 | + &num00, &cpi->fn_ptr[BLOCK_16X16], | |
| 238 | 238 | mvsadcost, mvcost); |
| 239 | 239 | } |
| 240 | 240 | else |
| @@ -245,7 +245,7 @@ static int find_matching_mb · 4 unmodified lines | ||
| 245 | 245 | &best_ref_mv1, &d->bmi.mv.as_mv, |
| 246 | 246 | step_param, |
| 247 | 247 | sadpb / 2/*x->errorperbit*/, |
| 248 | − &num00, &cpi->fn_ptr, | |
| 248 | + &num00, &cpi->fn_ptr[BLOCK_16X16], | |
| 249 | 249 | mvsadcost, mvcost); //sadpb < 9 |
| 250 | 250 | |
| 251 | 251 | // Further step/diamond searches as necessary |
| @@ -267,7 +267,7 @@ static int find_matching_mb · 15 unmodified lines | ||
| 267 | 267 | &best_ref_mv1, &d->bmi.mv.as_mv, |
| 268 | 268 | step_param + n, |
| 269 | 269 | sadpb / 4/*x->errorperbit*/, |
| 270 | − &num00, &cpi->fn_ptr, | |
| 270 | + &num00, &cpi->fn_ptr[BLOCK_16X16], | |
| 271 | 271 | mvsadcost, mvcost); //sadpb = 9 |
| 272 | 272 | |
| 273 | 273 | if (thissme < bestsme) |
| @@ -291,8 +291,8 @@ static int find_matching_mb · 17 unmodified lines | ||
| 291 | 291 | { |
| 292 | 292 | bestsme = cpi->find_fractional_mv_step(x, b, d, |
| 293 | 293 | &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); | |
| 296 | 296 | } |
| 297 | 297 | #endif |
| 298 | 298 | |
| @@ -219,6 +219,21 @@ extern prototype_subpixvariance(vp8_variance_subpixvar16x8); · 218 unmodified lines | ||
| 219 | 219 | #endif |
| 220 | 220 | extern 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 | |
| 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 | + | |
| 222 | 237 | #ifndef vp8_variance_subpixmse16x16 |
| 223 | 238 | #define vp8_variance_subpixmse16x16 vp8_sub_pixel_mse16x16_c |
| 224 | 239 | #endif |
| @@ -283,6 +298,9 @@ typedef struct · 58 unmodified lines | ||
| 283 | 298 | vp8_subpixvariance_fn_t subpixvar8x16; |
| 284 | 299 | vp8_subpixvariance_fn_t subpixvar16x8; |
| 285 | 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 | 304 | vp8_subpixvariance_fn_t subpixmse16x16; |
| 287 | 305 | |
| 288 | 306 | vp8_getmbss_fn_t getmbss; |
| @@ -309,11 +327,14 @@ typedef struct · 20 unmodified lines | ||
| 309 | 327 | |
| 310 | 328 | typedef struct |
| 311 | 329 | { |
| 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; | |
| 316 | 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 | 338 | } vp8_variance_fn_ptr_t; |
| 318 | 339 | |
| 319 | 340 | #if CONFIG_RUNTIME_CPU_DETECT |
| @@ -322,7 +343,4 @@ typedef struct · 2 unmodified lines | ||
| 322 | 343 | #define VARIANCE_INVOKE(ctx,fn) vp8_variance_##fn |
| 323 | 344 | #endif |
| 324 | 345 | |
| 325 | −/* TODO: Determine if this USEBILINEAR flag is necessary. */ | |
| 326 | −#define USEBILINEAR | |
| 327 | − | |
| 328 | 346 | #endif |
| @@ -24,7 +24,6 @@ const int vp8_six_tap[8][6] = · 23 unmodified lines | ||
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | 26 | |
| 27 | −#ifdef USEBILINEAR | |
| 28 | 27 | const int VP8_FILTER_WEIGHT = 128; |
| 29 | 28 | const int VP8_FILTER_SHIFT = 7; |
| 30 | 29 | const int vp8_bilinear_taps[8][2] = |
| @@ -461,6 +460,19 @@ unsigned int vp8_sub_pixel_variance16x16_c · 430 unmodified lines | ||
| 461 | 460 | return vp8_variance16x16_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse); |
| 462 | 461 | } |
| 463 | 462 | |
| 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 | + | |
| 464 | 476 | unsigned int vp8_sub_pixel_mse16x16_c |
| 465 | 477 | ( |
| 466 | 478 | const unsigned char *src_ptr, |
| @@ -525,4 +537,3 @@ unsigned int vp8_sub_pixel_variance8x16_c · 58 unmodified lines | ||
| 525 | 537 | |
| 526 | 538 | return vp8_variance8x16_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse); |
| 527 | 539 | } |
| 528 | −#endif | |
| @@ -19,7 +19,6 @@ VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/encodemb_arm.c · 18 unmodified lines | ||
| 19 | 19 | VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/quantize_arm.c |
| 20 | 20 | VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/picklpf_arm.c |
| 21 | 21 | VP8_CX_SRCS-$(HAVE_ARMV5TE) += encoder/arm/boolhuff_arm.c |
| 22 | −VP8_CX_SRCS-$(HAVE_ARMV7) += encoder/arm/mcomp_arm.c | |
| 23 | 22 | |
| 24 | 23 | VP8_CX_SRCS_REMOVE-$(HAVE_ARMV5TE) += encoder/boolhuff.c |
| 25 | 24 | |