| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 int bc = bestmv->col * 8; \ | 277 int bc = bestmv->col * 8; \ |
| 278 int hstep = 4; \ | 278 int hstep = 4; \ |
| 279 const int minc = MAX(x->mv_col_min * 8, ref_mv->col - MV_MAX); \ | 279 const int minc = MAX(x->mv_col_min * 8, ref_mv->col - MV_MAX); \ |
| 280 const int maxc = MIN(x->mv_col_max * 8, ref_mv->col + MV_MAX); \ | 280 const int maxc = MIN(x->mv_col_max * 8, ref_mv->col + MV_MAX); \ |
| 281 const int minr = MAX(x->mv_row_min * 8, ref_mv->row - MV_MAX); \ | 281 const int minr = MAX(x->mv_row_min * 8, ref_mv->row - MV_MAX); \ |
| 282 const int maxr = MIN(x->mv_row_max * 8, ref_mv->row + MV_MAX); \ | 282 const int maxr = MIN(x->mv_row_max * 8, ref_mv->row + MV_MAX); \ |
| 283 int tr = br; \ | 283 int tr = br; \ |
| 284 int tc = bc; \ | 284 int tc = bc; \ |
| 285 \ | 285 \ |
| 286 bestmv->row *= 8; \ | 286 bestmv->row *= 8; \ |
| 287 bestmv->col *= 8; \ | 287 bestmv->col *= 8; |
| 288 if (second_pred != NULL) { \ | 288 |
| 289 DECLARE_ALIGNED_ARRAY(16, uint8_t, comp_pred, 64 * 64); \ | 289 #if CONFIG_VP9_HIGHBITDEPTH |
| 290 vp9_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride); \ | 290 #define SETUP_CENTER_ERROR \ |
| 291 besterr = vfp->vf(comp_pred, w, z, src_stride, sse1); \ | 291 if (second_pred != NULL) { \ |
| 292 } else { \ | 292 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { \ |
| 293 besterr = vfp->vf(y + offset, y_stride, z, src_stride, sse1); \ | 293 DECLARE_ALIGNED_ARRAY(16, uint16_t, comp_pred16, 64 * 64); \ |
| 294 } \ | 294 vp9_highbd_comp_avg_pred(comp_pred16, second_pred, w, h, y + offset, \ |
| 295 *distortion = besterr; \ | 295 y_stride); \ |
| 296 besterr = vfp->vf(CONVERT_TO_BYTEPTR(comp_pred16), w, z, src_stride, \ |
| 297 sse1); \ |
| 298 } else { \ |
| 299 DECLARE_ALIGNED_ARRAY(16, uint8_t, comp_pred, 64 * 64); \ |
| 300 vp9_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride); \ |
| 301 besterr = vfp->vf(comp_pred, w, z, src_stride, sse1); \ |
| 302 } \ |
| 303 } else { \ |
| 304 besterr = vfp->vf(y + offset, y_stride, z, src_stride, sse1); \ |
| 305 } \ |
| 306 *distortion = besterr; \ |
| 296 besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit); | 307 besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit); |
| 297 | 308 |
| 309 #else |
| 310 |
| 311 #define SETUP_CENTER_ERROR \ |
| 312 if (second_pred != NULL) { \ |
| 313 DECLARE_ALIGNED_ARRAY(16, uint8_t, comp_pred, 64 * 64); \ |
| 314 vp9_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride); \ |
| 315 besterr = vfp->vf(comp_pred, w, z, src_stride, sse1); \ |
| 316 } else { \ |
| 317 besterr = vfp->vf(y + offset, y_stride, z, src_stride, sse1); \ |
| 318 } \ |
| 319 *distortion = besterr; \ |
| 320 besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit); |
| 321 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 322 |
| 323 |
| 324 |
| 325 |
| 326 static INLINE int divide_and_round(const int n, const int d) { |
| 327 return ((n < 0) ^ (d < 0)) ? ((n - d / 2) / d) : ((n + d / 2) / d); |
| 328 } |
| 329 |
| 330 static INLINE int is_cost_list_wellbehaved(int *cost_list) { |
| 331 return cost_list[0] < cost_list[1] && |
| 332 cost_list[0] < cost_list[2] && |
| 333 cost_list[0] < cost_list[3] && |
| 334 cost_list[0] < cost_list[4]; |
| 335 } |
| 336 |
| 337 // Returns surface minima estimate at given precision in 1/2^n bits. |
| 338 // Assume a model for the cost surface: S = A(x - x0)^2 + B(y - y0)^2 + C |
| 339 // For a given set of costs S0, S1, S2, S3, S4 at points |
| 340 // (y, x) = (0, 0), (0, -1), (1, 0), (0, 1) and (-1, 0) respectively, |
| 341 // the solution for the location of the minima (x0, y0) is given by: |
| 342 // x0 = 1/2 (S1 - S3)/(S1 + S3 - 2*S0), |
| 343 // y0 = 1/2 (S4 - S2)/(S4 + S2 - 2*S0). |
| 344 // The code below is an integerized version of that. |
| 345 static void get_cost_surf_min(int *cost_list, int *ir, int *ic, |
| 346 int bits) { |
| 347 *ic = divide_and_round((cost_list[1] - cost_list[3]) * (1 << (bits - 1)), |
| 348 (cost_list[1] - 2 * cost_list[0] + cost_list[3])); |
| 349 *ir = divide_and_round((cost_list[4] - cost_list[2]) * (1 << (bits - 1)), |
| 350 (cost_list[4] - 2 * cost_list[0] + cost_list[2])); |
| 351 } |
| 352 |
| 353 int vp9_find_best_sub_pixel_tree_pruned_evenmore( |
| 354 const MACROBLOCK *x, |
| 355 MV *bestmv, const MV *ref_mv, |
| 356 int allow_hp, |
| 357 int error_per_bit, |
| 358 const vp9_variance_fn_ptr_t *vfp, |
| 359 int forced_stop, |
| 360 int iters_per_step, |
| 361 int *cost_list, |
| 362 int *mvjcost, int *mvcost[2], |
| 363 int *distortion, |
| 364 unsigned int *sse1, |
| 365 const uint8_t *second_pred, |
| 366 int w, int h) { |
| 367 SETUP_SUBPEL_SEARCH; |
| 368 SETUP_CENTER_ERROR; |
| 369 (void) halfiters; |
| 370 (void) quarteriters; |
| 371 (void) eighthiters; |
| 372 (void) whichdir; |
| 373 (void) allow_hp; |
| 374 (void) forced_stop; |
| 375 (void) hstep; |
| 376 |
| 377 if (cost_list && |
| 378 cost_list[0] != INT_MAX && cost_list[1] != INT_MAX && |
| 379 cost_list[2] != INT_MAX && cost_list[3] != INT_MAX && |
| 380 cost_list[4] != INT_MAX && |
| 381 is_cost_list_wellbehaved(cost_list)) { |
| 382 int ir, ic; |
| 383 unsigned int minpt; |
| 384 get_cost_surf_min(cost_list, &ir, &ic, 2); |
| 385 if (ir != 0 || ic != 0) { |
| 386 CHECK_BETTER(minpt, tr + 2 * ir, tc + 2 * ic); |
| 387 } |
| 388 } else { |
| 389 FIRST_LEVEL_CHECKS; |
| 390 if (halfiters > 1) { |
| 391 SECOND_LEVEL_CHECKS; |
| 392 } |
| 393 |
| 394 tr = br; |
| 395 tc = bc; |
| 396 |
| 397 // Each subsequent iteration checks at least one point in common with |
| 398 // the last iteration could be 2 ( if diag selected) 1/4 pel |
| 399 // Note forced_stop: 0 - full, 1 - qtr only, 2 - half only |
| 400 if (forced_stop != 2) { |
| 401 hstep >>= 1; |
| 402 FIRST_LEVEL_CHECKS; |
| 403 if (quarteriters > 1) { |
| 404 SECOND_LEVEL_CHECKS; |
| 405 } |
| 406 } |
| 407 } |
| 408 |
| 409 tr = br; |
| 410 tc = bc; |
| 411 |
| 412 if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) { |
| 413 hstep >>= 1; |
| 414 FIRST_LEVEL_CHECKS; |
| 415 if (eighthiters > 1) { |
| 416 SECOND_LEVEL_CHECKS; |
| 417 } |
| 418 } |
| 419 |
| 420 bestmv->row = br; |
| 421 bestmv->col = bc; |
| 422 |
| 423 if ((abs(bestmv->col - ref_mv->col) > (MAX_FULL_PEL_VAL << 3)) || |
| 424 (abs(bestmv->row - ref_mv->row) > (MAX_FULL_PEL_VAL << 3))) |
| 425 return INT_MAX; |
| 426 |
| 427 return besterr; |
| 428 } |
| 429 |
| 430 int vp9_find_best_sub_pixel_tree_pruned_more(const MACROBLOCK *x, |
| 431 MV *bestmv, const MV *ref_mv, |
| 432 int allow_hp, |
| 433 int error_per_bit, |
| 434 const vp9_variance_fn_ptr_t *vfp, |
| 435 int forced_stop, |
| 436 int iters_per_step, |
| 437 int *cost_list, |
| 438 int *mvjcost, int *mvcost[2], |
| 439 int *distortion, |
| 440 unsigned int *sse1, |
| 441 const uint8_t *second_pred, |
| 442 int w, int h) { |
| 443 SETUP_SUBPEL_SEARCH; |
| 444 SETUP_CENTER_ERROR; |
| 445 if (cost_list && |
| 446 cost_list[0] != INT_MAX && cost_list[1] != INT_MAX && |
| 447 cost_list[2] != INT_MAX && cost_list[3] != INT_MAX && |
| 448 cost_list[4] != INT_MAX && |
| 449 is_cost_list_wellbehaved(cost_list)) { |
| 450 unsigned int minpt; |
| 451 int ir, ic; |
| 452 get_cost_surf_min(cost_list, &ir, &ic, 1); |
| 453 if (ir != 0 || ic != 0) { |
| 454 CHECK_BETTER(minpt, tr + ir * hstep, tc + ic * hstep); |
| 455 } |
| 456 } else { |
| 457 FIRST_LEVEL_CHECKS; |
| 458 if (halfiters > 1) { |
| 459 SECOND_LEVEL_CHECKS; |
| 460 } |
| 461 } |
| 462 |
| 463 // Each subsequent iteration checks at least one point in common with |
| 464 // the last iteration could be 2 ( if diag selected) 1/4 pel |
| 465 |
| 466 // Note forced_stop: 0 - full, 1 - qtr only, 2 - half only |
| 467 if (forced_stop != 2) { |
| 468 tr = br; |
| 469 tc = bc; |
| 470 hstep >>= 1; |
| 471 FIRST_LEVEL_CHECKS; |
| 472 if (quarteriters > 1) { |
| 473 SECOND_LEVEL_CHECKS; |
| 474 } |
| 475 } |
| 476 |
| 477 if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) { |
| 478 tr = br; |
| 479 tc = bc; |
| 480 hstep >>= 1; |
| 481 FIRST_LEVEL_CHECKS; |
| 482 if (eighthiters > 1) { |
| 483 SECOND_LEVEL_CHECKS; |
| 484 } |
| 485 } |
| 486 // These lines insure static analysis doesn't warn that |
| 487 // tr and tc aren't used after the above point. |
| 488 (void) tr; |
| 489 (void) tc; |
| 490 |
| 491 bestmv->row = br; |
| 492 bestmv->col = bc; |
| 493 |
| 494 if ((abs(bestmv->col - ref_mv->col) > (MAX_FULL_PEL_VAL << 3)) || |
| 495 (abs(bestmv->row - ref_mv->row) > (MAX_FULL_PEL_VAL << 3))) |
| 496 return INT_MAX; |
| 497 |
| 498 return besterr; |
| 499 } |
| 500 |
| 298 int vp9_find_best_sub_pixel_tree_pruned(const MACROBLOCK *x, | 501 int vp9_find_best_sub_pixel_tree_pruned(const MACROBLOCK *x, |
| 299 MV *bestmv, const MV *ref_mv, | 502 MV *bestmv, const MV *ref_mv, |
| 300 int allow_hp, | 503 int allow_hp, |
| 301 int error_per_bit, | 504 int error_per_bit, |
| 302 const vp9_variance_fn_ptr_t *vfp, | 505 const vp9_variance_fn_ptr_t *vfp, |
| 303 int forced_stop, | 506 int forced_stop, |
| 304 int iters_per_step, | 507 int iters_per_step, |
| 305 int *sad_list, | 508 int *cost_list, |
| 306 int *mvjcost, int *mvcost[2], | 509 int *mvjcost, int *mvcost[2], |
| 307 int *distortion, | 510 int *distortion, |
| 308 unsigned int *sse1, | 511 unsigned int *sse1, |
| 309 const uint8_t *second_pred, | 512 const uint8_t *second_pred, |
| 310 int w, int h) { | 513 int w, int h) { |
| 311 SETUP_SUBPEL_SEARCH; | 514 SETUP_SUBPEL_SEARCH; |
| 312 | 515 SETUP_CENTER_ERROR; |
| 313 if (sad_list && | 516 if (cost_list && |
| 314 sad_list[0] != INT_MAX && sad_list[1] != INT_MAX && | 517 cost_list[0] != INT_MAX && cost_list[1] != INT_MAX && |
| 315 sad_list[2] != INT_MAX && sad_list[3] != INT_MAX && | 518 cost_list[2] != INT_MAX && cost_list[3] != INT_MAX && |
| 316 sad_list[4] != INT_MAX) { | 519 cost_list[4] != INT_MAX) { |
| 317 unsigned int left, right, up, down, diag; | 520 unsigned int left, right, up, down, diag; |
| 318 whichdir = (sad_list[1] < sad_list[3] ? 0 : 1) + | 521 whichdir = (cost_list[1] < cost_list[3] ? 0 : 1) + |
| 319 (sad_list[2] < sad_list[4] ? 0 : 2); | 522 (cost_list[2] < cost_list[4] ? 0 : 2); |
| 320 switch (whichdir) { | 523 switch (whichdir) { |
| 321 case 0: | 524 case 0: |
| 322 CHECK_BETTER(left, tr, tc - hstep); | 525 CHECK_BETTER(left, tr, tc - hstep); |
| 323 CHECK_BETTER(down, tr + hstep, tc); | 526 CHECK_BETTER(down, tr + hstep, tc); |
| 324 CHECK_BETTER(diag, tr + hstep, tc - hstep); | 527 CHECK_BETTER(diag, tr + hstep, tc - hstep); |
| 325 break; | 528 break; |
| 326 case 1: | 529 case 1: |
| 327 CHECK_BETTER(right, tr, tc + hstep); | 530 CHECK_BETTER(right, tr, tc + hstep); |
| 328 CHECK_BETTER(down, tr + hstep, tc); | 531 CHECK_BETTER(down, tr + hstep, tc); |
| 329 CHECK_BETTER(diag, tr + hstep, tc + hstep); | 532 CHECK_BETTER(diag, tr + hstep, tc + hstep); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 return besterr; | 590 return besterr; |
| 388 } | 591 } |
| 389 | 592 |
| 390 int vp9_find_best_sub_pixel_tree(const MACROBLOCK *x, | 593 int vp9_find_best_sub_pixel_tree(const MACROBLOCK *x, |
| 391 MV *bestmv, const MV *ref_mv, | 594 MV *bestmv, const MV *ref_mv, |
| 392 int allow_hp, | 595 int allow_hp, |
| 393 int error_per_bit, | 596 int error_per_bit, |
| 394 const vp9_variance_fn_ptr_t *vfp, | 597 const vp9_variance_fn_ptr_t *vfp, |
| 395 int forced_stop, | 598 int forced_stop, |
| 396 int iters_per_step, | 599 int iters_per_step, |
| 397 int *sad_list, | 600 int *cost_list, |
| 398 int *mvjcost, int *mvcost[2], | 601 int *mvjcost, int *mvcost[2], |
| 399 int *distortion, | 602 int *distortion, |
| 400 unsigned int *sse1, | 603 unsigned int *sse1, |
| 401 const uint8_t *second_pred, | 604 const uint8_t *second_pred, |
| 402 int w, int h) { | 605 int w, int h) { |
| 403 SETUP_SUBPEL_SEARCH; | 606 SETUP_SUBPEL_SEARCH; |
| 404 (void) sad_list; // to silence compiler warning | 607 SETUP_CENTER_ERROR; |
| 608 (void) cost_list; // to silence compiler warning |
| 405 | 609 |
| 406 // Each subsequent iteration checks at least one point in | 610 // Each subsequent iteration checks at least one point in |
| 407 // common with the last iteration could be 2 ( if diag selected) | 611 // common with the last iteration could be 2 ( if diag selected) |
| 408 // 1/2 pel | 612 // 1/2 pel |
| 409 FIRST_LEVEL_CHECKS; | 613 FIRST_LEVEL_CHECKS; |
| 410 if (halfiters > 1) { | 614 if (halfiters > 1) { |
| 411 SECOND_LEVEL_CHECKS; | 615 SECOND_LEVEL_CHECKS; |
| 412 } | 616 } |
| 413 tr = br; | 617 tr = br; |
| 414 tc = bc; | 618 tc = bc; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 bestsad = thissad;\ | 681 bestsad = thissad;\ |
| 478 best_site = i;\ | 682 best_site = i;\ |
| 479 }\ | 683 }\ |
| 480 }\ | 684 }\ |
| 481 } | 685 } |
| 482 | 686 |
| 483 #define MAX_PATTERN_SCALES 11 | 687 #define MAX_PATTERN_SCALES 11 |
| 484 #define MAX_PATTERN_CANDIDATES 8 // max number of canddiates per scale | 688 #define MAX_PATTERN_CANDIDATES 8 // max number of canddiates per scale |
| 485 #define PATTERN_CANDIDATES_REF 3 // number of refinement candidates | 689 #define PATTERN_CANDIDATES_REF 3 // number of refinement candidates |
| 486 | 690 |
| 691 // Calculate and return a sad+mvcost list around an integer best pel. |
| 692 static INLINE void calc_int_cost_list(const MACROBLOCK *x, |
| 693 const MV *ref_mv, |
| 694 int sadpb, |
| 695 const vp9_variance_fn_ptr_t *fn_ptr, |
| 696 const MV *best_mv, |
| 697 int *cost_list) { |
| 698 static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; |
| 699 const struct buf_2d *const what = &x->plane[0].src; |
| 700 const struct buf_2d *const in_what = &x->e_mbd.plane[0].pre[0]; |
| 701 const MV fcenter_mv = {ref_mv->row >> 3, ref_mv->col >> 3}; |
| 702 int br = best_mv->row; |
| 703 int bc = best_mv->col; |
| 704 MV this_mv; |
| 705 int i; |
| 706 unsigned int sse; |
| 707 |
| 708 this_mv.row = br; |
| 709 this_mv.col = bc; |
| 710 cost_list[0] = fn_ptr->vf(what->buf, what->stride, |
| 711 get_buf_from_mv(in_what, &this_mv), |
| 712 in_what->stride, &sse) + |
| 713 mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb); |
| 714 if (check_bounds(x, br, bc, 1)) { |
| 715 for (i = 0; i < 4; i++) { |
| 716 const MV this_mv = {br + neighbors[i].row, |
| 717 bc + neighbors[i].col}; |
| 718 cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride, |
| 719 get_buf_from_mv(in_what, &this_mv), |
| 720 in_what->stride, &sse) + |
| 721 // mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb); |
| 722 mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost, |
| 723 x->errorperbit); |
| 724 } |
| 725 } else { |
| 726 for (i = 0; i < 4; i++) { |
| 727 const MV this_mv = {br + neighbors[i].row, |
| 728 bc + neighbors[i].col}; |
| 729 if (!is_mv_in(x, &this_mv)) |
| 730 cost_list[i + 1] = INT_MAX; |
| 731 else |
| 732 cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride, |
| 733 get_buf_from_mv(in_what, &this_mv), |
| 734 in_what->stride, &sse) + |
| 735 // mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb); |
| 736 mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost, |
| 737 x->errorperbit); |
| 738 } |
| 739 } |
| 740 } |
| 741 |
| 487 // Generic pattern search function that searches over multiple scales. | 742 // Generic pattern search function that searches over multiple scales. |
| 488 // Each scale can have a different number of candidates and shape of | 743 // Each scale can have a different number of candidates and shape of |
| 489 // candidates as indicated in the num_candidates and candidates arrays | 744 // candidates as indicated in the num_candidates and candidates arrays |
| 490 // passed into this function | 745 // passed into this function |
| 491 // | 746 // |
| 492 static int vp9_pattern_search(const MACROBLOCK *x, | 747 static int vp9_pattern_search(const MACROBLOCK *x, |
| 493 MV *ref_mv, | 748 MV *ref_mv, |
| 494 int search_param, | 749 int search_param, |
| 495 int sad_per_bit, | 750 int sad_per_bit, |
| 496 int do_init_search, | 751 int do_init_search, |
| 497 int *sad_list, | 752 int *cost_list, |
| 498 const vp9_variance_fn_ptr_t *vfp, | 753 const vp9_variance_fn_ptr_t *vfp, |
| 499 int use_mvcost, | 754 int use_mvcost, |
| 500 const MV *center_mv, | 755 const MV *center_mv, |
| 501 MV *best_mv, | 756 MV *best_mv, |
| 502 const int num_candidates[MAX_PATTERN_SCALES], | 757 const int num_candidates[MAX_PATTERN_SCALES], |
| 503 const MV candidates[MAX_PATTERN_SCALES] | 758 const MV candidates[MAX_PATTERN_SCALES] |
| 504 [MAX_PATTERN_CANDIDATES]) { | 759 [MAX_PATTERN_CANDIDATES]) { |
| 505 const MACROBLOCKD *const xd = &x->e_mbd; | 760 const MACROBLOCKD *const xd = &x->e_mbd; |
| 506 static const int search_param_to_steps[MAX_MVSEARCH_STEPS] = { | 761 static const int search_param_to_steps[MAX_MVSEARCH_STEPS] = { |
| 507 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, | 762 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (best_site != -1) { | 894 if (best_site != -1) { |
| 640 k = next_chkpts_indices[best_site]; | 895 k = next_chkpts_indices[best_site]; |
| 641 br += candidates[s][k].row; | 896 br += candidates[s][k].row; |
| 642 bc += candidates[s][k].col; | 897 bc += candidates[s][k].col; |
| 643 } | 898 } |
| 644 } while (best_site != -1); | 899 } while (best_site != -1); |
| 645 } while (s--); | 900 } while (s--); |
| 646 } | 901 } |
| 647 | 902 |
| 648 // Returns the one-away integer pel sad values around the best as follows: | 903 // Returns the one-away integer pel sad values around the best as follows: |
| 649 // sad_list[0]: sad at the best integer pel | 904 // cost_list[0]: cost at the best integer pel |
| 650 // sad_list[1]: sad at delta {0, -1} (left) from the best integer pel | 905 // cost_list[1]: cost at delta {0, -1} (left) from the best integer pel |
| 651 // sad_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel | 906 // cost_list[2]: cost at delta { 1, 0} (bottom) from the best integer pel |
| 652 // sad_list[3]: sad at delta { 0, 1} (right) from the best integer pel | 907 // cost_list[3]: cost at delta { 0, 1} (right) from the best integer pel |
| 653 // sad_list[4]: sad at delta {-1, 0} (top) from the best integer pel | 908 // cost_list[4]: cost at delta {-1, 0} (top) from the best integer pel |
| 654 if (sad_list) { | 909 if (cost_list) { |
| 655 static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; | 910 const MV best_mv = { br, bc }; |
| 656 sad_list[0] = bestsad; | 911 calc_int_cost_list(x, &fcenter_mv, sad_per_bit, vfp, &best_mv, cost_list); |
| 657 if (check_bounds(x, br, bc, 1)) { | |
| 658 for (i = 0; i < 4; i++) { | |
| 659 const MV this_mv = {br + neighbors[i].row, | |
| 660 bc + neighbors[i].col}; | |
| 661 sad_list[i + 1] = vfp->sdf(what->buf, what->stride, | |
| 662 get_buf_from_mv(in_what, &this_mv), | |
| 663 in_what->stride) + | |
| 664 (use_mvcost ? | |
| 665 mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit) : | |
| 666 0); | |
| 667 } | |
| 668 } else { | |
| 669 for (i = 0; i < 4; i++) { | |
| 670 const MV this_mv = {br + neighbors[i].row, | |
| 671 bc + neighbors[i].col}; | |
| 672 if (!is_mv_in(x, &this_mv)) | |
| 673 sad_list[i + 1] = INT_MAX; | |
| 674 else | |
| 675 sad_list[i + 1] = vfp->sdf(what->buf, what->stride, | |
| 676 get_buf_from_mv(in_what, &this_mv), | |
| 677 in_what->stride) + | |
| 678 (use_mvcost ? | |
| 679 mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit) : | |
| 680 0); | |
| 681 } | |
| 682 } | |
| 683 } | 912 } |
| 684 best_mv->row = br; | 913 best_mv->row = br; |
| 685 best_mv->col = bc; | 914 best_mv->col = bc; |
| 686 return bestsad; | 915 return bestsad; |
| 687 } | 916 } |
| 688 | 917 |
| 689 // A specialized function where the smallest scale search candidates | 918 // A specialized function where the smallest scale search candidates |
| 690 // are 4 1-away neighbors, and sad_list is non-null | 919 // are 4 1-away neighbors, and cost_list is non-null |
| 691 // TODO(debargha): Merge this function with the one above. Also remove | 920 // TODO(debargha): Merge this function with the one above. Also remove |
| 692 // use_mvcost option since it is always 1, to save unnecessary branches. | 921 // use_mvcost option since it is always 1, to save unnecessary branches. |
| 693 static int vp9_pattern_search_sad(const MACROBLOCK *x, | 922 static int vp9_pattern_search_sad(const MACROBLOCK *x, |
| 694 MV *ref_mv, | 923 MV *ref_mv, |
| 695 int search_param, | 924 int search_param, |
| 696 int sad_per_bit, | 925 int sad_per_bit, |
| 697 int do_init_search, | 926 int do_init_search, |
| 698 int *sad_list, | 927 int *cost_list, |
| 699 const vp9_variance_fn_ptr_t *vfp, | 928 const vp9_variance_fn_ptr_t *vfp, |
| 700 int use_mvcost, | 929 int use_mvcost, |
| 701 const MV *center_mv, | 930 const MV *center_mv, |
| 702 MV *best_mv, | 931 MV *best_mv, |
| 703 const int num_candidates[MAX_PATTERN_SCALES], | 932 const int num_candidates[MAX_PATTERN_SCALES], |
| 704 const MV candidates[MAX_PATTERN_SCALES] | 933 const MV candidates[MAX_PATTERN_SCALES] |
| 705 [MAX_PATTERN_CANDIDATES]) { | 934 [MAX_PATTERN_CANDIDATES]) { |
| 706 const MACROBLOCKD *const xd = &x->e_mbd; | 935 const MACROBLOCKD *const xd = &x->e_mbd; |
| 707 static const int search_param_to_steps[MAX_MVSEARCH_STEPS] = { | 936 static const int search_param_to_steps[MAX_MVSEARCH_STEPS] = { |
| 708 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, | 937 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, |
| 709 }; | 938 }; |
| 710 int i, s, t; | 939 int i, s, t; |
| 711 const struct buf_2d *const what = &x->plane[0].src; | 940 const struct buf_2d *const what = &x->plane[0].src; |
| 712 const struct buf_2d *const in_what = &xd->plane[0].pre[0]; | 941 const struct buf_2d *const in_what = &xd->plane[0].pre[0]; |
| 713 int br, bc; | 942 int br, bc; |
| 714 int bestsad = INT_MAX; | 943 int bestsad = INT_MAX; |
| 715 int thissad; | 944 int thissad; |
| 716 int k = -1; | 945 int k = -1; |
| 717 const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3}; | 946 const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3}; |
| 718 int best_init_s = search_param_to_steps[search_param]; | 947 int best_init_s = search_param_to_steps[search_param]; |
| 719 // adjust ref_mv to make sure it is within MV range | 948 // adjust ref_mv to make sure it is within MV range |
| 720 clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max); | 949 clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max); |
| 721 br = ref_mv->row; | 950 br = ref_mv->row; |
| 722 bc = ref_mv->col; | 951 bc = ref_mv->col; |
| 723 if (sad_list != NULL) { | 952 if (cost_list != NULL) { |
| 724 sad_list[0] = sad_list[1] = sad_list[2] = sad_list[3] = sad_list[4] = | 953 cost_list[0] = cost_list[1] = cost_list[2] = cost_list[3] = cost_list[4] = |
| 725 INT_MAX; | 954 INT_MAX; |
| 726 } | 955 } |
| 727 | 956 |
| 728 // Work out the start point for the search | 957 // Work out the start point for the search |
| 729 bestsad = vfp->sdf(what->buf, what->stride, | 958 bestsad = vfp->sdf(what->buf, what->stride, |
| 730 get_buf_from_mv(in_what, ref_mv), in_what->stride) + | 959 get_buf_from_mv(in_what, ref_mv), in_what->stride) + |
| 731 mvsad_err_cost(x, ref_mv, &fcenter_mv, sad_per_bit); | 960 mvsad_err_cost(x, ref_mv, &fcenter_mv, sad_per_bit); |
| 732 | 961 |
| 733 // Search all possible scales upto the search param around the center point | 962 // Search all possible scales upto the search param around the center point |
| 734 // pick the scale of the point that is best as the starting scale of | 963 // pick the scale of the point that is best as the starting scale of |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 } | 997 } |
| 769 if (best_init_s != -1) { | 998 if (best_init_s != -1) { |
| 770 br += candidates[best_init_s][k].row; | 999 br += candidates[best_init_s][k].row; |
| 771 bc += candidates[best_init_s][k].col; | 1000 bc += candidates[best_init_s][k].col; |
| 772 } | 1001 } |
| 773 } | 1002 } |
| 774 | 1003 |
| 775 // If the center point is still the best, just skip this and move to | 1004 // If the center point is still the best, just skip this and move to |
| 776 // the refinement step. | 1005 // the refinement step. |
| 777 if (best_init_s != -1) { | 1006 if (best_init_s != -1) { |
| 778 int do_sad = (num_candidates[0] == 4 && sad_list != NULL); | 1007 int do_sad = (num_candidates[0] == 4 && cost_list != NULL); |
| 779 int best_site = -1; | 1008 int best_site = -1; |
| 780 s = best_init_s; | 1009 s = best_init_s; |
| 781 | 1010 |
| 782 for (; s >= do_sad; s--) { | 1011 for (; s >= do_sad; s--) { |
| 783 if (!do_init_search || s != best_init_s) { | 1012 if (!do_init_search || s != best_init_s) { |
| 784 if (check_bounds(x, br, bc, 1 << s)) { | 1013 if (check_bounds(x, br, bc, 1 << s)) { |
| 785 for (i = 0; i < num_candidates[s]; i++) { | 1014 for (i = 0; i < num_candidates[s]; i++) { |
| 786 const MV this_mv = {br + candidates[s][i].row, | 1015 const MV this_mv = {br + candidates[s][i].row, |
| 787 bc + candidates[s][i].col}; | 1016 bc + candidates[s][i].col}; |
| 788 thissad = vfp->sdf(what->buf, what->stride, | 1017 thissad = vfp->sdf(what->buf, what->stride, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 } | 1071 } |
| 843 | 1072 |
| 844 if (best_site != -1) { | 1073 if (best_site != -1) { |
| 845 k = next_chkpts_indices[best_site]; | 1074 k = next_chkpts_indices[best_site]; |
| 846 br += candidates[s][k].row; | 1075 br += candidates[s][k].row; |
| 847 bc += candidates[s][k].col; | 1076 bc += candidates[s][k].col; |
| 848 } | 1077 } |
| 849 } while (best_site != -1); | 1078 } while (best_site != -1); |
| 850 } | 1079 } |
| 851 | 1080 |
| 852 // Note: If we enter the if below, then sad_list must be non-NULL. | 1081 // Note: If we enter the if below, then cost_list must be non-NULL. |
| 853 if (s == 0) { | 1082 if (s == 0) { |
| 854 sad_list[0] = bestsad; | 1083 cost_list[0] = bestsad; |
| 855 if (!do_init_search || s != best_init_s) { | 1084 if (!do_init_search || s != best_init_s) { |
| 856 if (check_bounds(x, br, bc, 1 << s)) { | 1085 if (check_bounds(x, br, bc, 1 << s)) { |
| 857 for (i = 0; i < num_candidates[s]; i++) { | 1086 for (i = 0; i < num_candidates[s]; i++) { |
| 858 const MV this_mv = {br + candidates[s][i].row, | 1087 const MV this_mv = {br + candidates[s][i].row, |
| 859 bc + candidates[s][i].col}; | 1088 bc + candidates[s][i].col}; |
| 860 sad_list[i + 1] = | 1089 cost_list[i + 1] = |
| 861 thissad = vfp->sdf(what->buf, what->stride, | 1090 thissad = vfp->sdf(what->buf, what->stride, |
| 862 get_buf_from_mv(in_what, &this_mv), | 1091 get_buf_from_mv(in_what, &this_mv), |
| 863 in_what->stride); | 1092 in_what->stride); |
| 864 CHECK_BETTER | 1093 CHECK_BETTER |
| 865 } | 1094 } |
| 866 } else { | 1095 } else { |
| 867 for (i = 0; i < num_candidates[s]; i++) { | 1096 for (i = 0; i < num_candidates[s]; i++) { |
| 868 const MV this_mv = {br + candidates[s][i].row, | 1097 const MV this_mv = {br + candidates[s][i].row, |
| 869 bc + candidates[s][i].col}; | 1098 bc + candidates[s][i].col}; |
| 870 if (!is_mv_in(x, &this_mv)) | 1099 if (!is_mv_in(x, &this_mv)) |
| 871 continue; | 1100 continue; |
| 872 sad_list[i + 1] = | 1101 cost_list[i + 1] = |
| 873 thissad = vfp->sdf(what->buf, what->stride, | 1102 thissad = vfp->sdf(what->buf, what->stride, |
| 874 get_buf_from_mv(in_what, &this_mv), | 1103 get_buf_from_mv(in_what, &this_mv), |
| 875 in_what->stride); | 1104 in_what->stride); |
| 876 CHECK_BETTER | 1105 CHECK_BETTER |
| 877 } | 1106 } |
| 878 } | 1107 } |
| 879 | 1108 |
| 880 if (best_site != -1) { | 1109 if (best_site != -1) { |
| 881 br += candidates[s][best_site].row; | 1110 br += candidates[s][best_site].row; |
| 882 bc += candidates[s][best_site].col; | 1111 bc += candidates[s][best_site].col; |
| 883 k = best_site; | 1112 k = best_site; |
| 884 } | 1113 } |
| 885 } | 1114 } |
| 886 while (best_site != -1) { | 1115 while (best_site != -1) { |
| 887 int next_chkpts_indices[PATTERN_CANDIDATES_REF]; | 1116 int next_chkpts_indices[PATTERN_CANDIDATES_REF]; |
| 888 best_site = -1; | 1117 best_site = -1; |
| 889 next_chkpts_indices[0] = (k == 0) ? num_candidates[s] - 1 : k - 1; | 1118 next_chkpts_indices[0] = (k == 0) ? num_candidates[s] - 1 : k - 1; |
| 890 next_chkpts_indices[1] = k; | 1119 next_chkpts_indices[1] = k; |
| 891 next_chkpts_indices[2] = (k == num_candidates[s] - 1) ? 0 : k + 1; | 1120 next_chkpts_indices[2] = (k == num_candidates[s] - 1) ? 0 : k + 1; |
| 892 sad_list[1] = sad_list[2] = sad_list[3] = sad_list[4] = INT_MAX; | 1121 cost_list[1] = cost_list[2] = cost_list[3] = cost_list[4] = INT_MAX; |
| 893 sad_list[((k + 2) % 4) + 1] = sad_list[0]; | 1122 cost_list[((k + 2) % 4) + 1] = cost_list[0]; |
| 894 sad_list[0] = bestsad; | 1123 cost_list[0] = bestsad; |
| 895 | 1124 |
| 896 if (check_bounds(x, br, bc, 1 << s)) { | 1125 if (check_bounds(x, br, bc, 1 << s)) { |
| 897 for (i = 0; i < PATTERN_CANDIDATES_REF; i++) { | 1126 for (i = 0; i < PATTERN_CANDIDATES_REF; i++) { |
| 898 const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row, | 1127 const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row, |
| 899 bc + candidates[s][next_chkpts_indices[i]].col}; | 1128 bc + candidates[s][next_chkpts_indices[i]].col}; |
| 900 sad_list[next_chkpts_indices[i] + 1] = | 1129 cost_list[next_chkpts_indices[i] + 1] = |
| 901 thissad = vfp->sdf(what->buf, what->stride, | 1130 thissad = vfp->sdf(what->buf, what->stride, |
| 902 get_buf_from_mv(in_what, &this_mv), | 1131 get_buf_from_mv(in_what, &this_mv), |
| 903 in_what->stride); | 1132 in_what->stride); |
| 904 CHECK_BETTER | 1133 CHECK_BETTER |
| 905 } | 1134 } |
| 906 } else { | 1135 } else { |
| 907 for (i = 0; i < PATTERN_CANDIDATES_REF; i++) { | 1136 for (i = 0; i < PATTERN_CANDIDATES_REF; i++) { |
| 908 const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row, | 1137 const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row, |
| 909 bc + candidates[s][next_chkpts_indices[i]].col}; | 1138 bc + candidates[s][next_chkpts_indices[i]].col}; |
| 910 if (!is_mv_in(x, &this_mv)) { | 1139 if (!is_mv_in(x, &this_mv)) { |
| 911 sad_list[next_chkpts_indices[i] + 1] = INT_MAX; | 1140 cost_list[next_chkpts_indices[i] + 1] = INT_MAX; |
| 912 continue; | 1141 continue; |
| 913 } | 1142 } |
| 914 sad_list[next_chkpts_indices[i] + 1] = | 1143 cost_list[next_chkpts_indices[i] + 1] = |
| 915 thissad = vfp->sdf(what->buf, what->stride, | 1144 thissad = vfp->sdf(what->buf, what->stride, |
| 916 get_buf_from_mv(in_what, &this_mv), | 1145 get_buf_from_mv(in_what, &this_mv), |
| 917 in_what->stride); | 1146 in_what->stride); |
| 918 CHECK_BETTER | 1147 CHECK_BETTER |
| 919 } | 1148 } |
| 920 } | 1149 } |
| 921 | 1150 |
| 922 if (best_site != -1) { | 1151 if (best_site != -1) { |
| 923 k = next_chkpts_indices[best_site]; | 1152 k = next_chkpts_indices[best_site]; |
| 924 br += candidates[s][k].row; | 1153 br += candidates[s][k].row; |
| 925 bc += candidates[s][k].col; | 1154 bc += candidates[s][k].col; |
| 926 } | 1155 } |
| 927 } | 1156 } |
| 928 } | 1157 } |
| 929 } | 1158 } |
| 930 | 1159 |
| 931 // Returns the one-away integer pel sad values around the best as follows: | 1160 // Returns the one-away integer pel sad values around the best as follows: |
| 932 // sad_list[0]: sad at the best integer pel | 1161 // cost_list[0]: sad at the best integer pel |
| 933 // sad_list[1]: sad at delta {0, -1} (left) from the best integer pel | 1162 // cost_list[1]: sad at delta {0, -1} (left) from the best integer pel |
| 934 // sad_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel | 1163 // cost_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel |
| 935 // sad_list[3]: sad at delta { 0, 1} (right) from the best integer pel | 1164 // cost_list[3]: sad at delta { 0, 1} (right) from the best integer pel |
| 936 // sad_list[4]: sad at delta {-1, 0} (top) from the best integer pel | 1165 // cost_list[4]: sad at delta {-1, 0} (top) from the best integer pel |
| 937 if (sad_list) { | 1166 if (cost_list) { |
| 938 static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; | 1167 static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; |
| 939 if (sad_list[0] == INT_MAX) { | 1168 if (cost_list[0] == INT_MAX) { |
| 940 sad_list[0] = bestsad; | 1169 cost_list[0] = bestsad; |
| 941 if (check_bounds(x, br, bc, 1)) { | 1170 if (check_bounds(x, br, bc, 1)) { |
| 942 for (i = 0; i < 4; i++) { | 1171 for (i = 0; i < 4; i++) { |
| 943 const MV this_mv = {br + neighbors[i].row, | 1172 const MV this_mv = { br + neighbors[i].row, |
| 944 bc + neighbors[i].col}; | 1173 bc + neighbors[i].col }; |
| 945 sad_list[i + 1] = vfp->sdf(what->buf, what->stride, | 1174 cost_list[i + 1] = vfp->sdf(what->buf, what->stride, |
| 946 get_buf_from_mv(in_what, &this_mv), | 1175 get_buf_from_mv(in_what, &this_mv), |
| 947 in_what->stride); | 1176 in_what->stride); |
| 948 } | 1177 } |
| 949 } else { | 1178 } else { |
| 950 for (i = 0; i < 4; i++) { | 1179 for (i = 0; i < 4; i++) { |
| 951 const MV this_mv = {br + neighbors[i].row, | 1180 const MV this_mv = {br + neighbors[i].row, |
| 952 bc + neighbors[i].col}; | 1181 bc + neighbors[i].col}; |
| 953 if (!is_mv_in(x, &this_mv)) | 1182 if (!is_mv_in(x, &this_mv)) |
| 954 sad_list[i + 1] = INT_MAX; | 1183 cost_list[i + 1] = INT_MAX; |
| 955 else | 1184 else |
| 956 sad_list[i + 1] = vfp->sdf(what->buf, what->stride, | 1185 cost_list[i + 1] = vfp->sdf(what->buf, what->stride, |
| 957 get_buf_from_mv(in_what, &this_mv), | 1186 get_buf_from_mv(in_what, &this_mv), |
| 958 in_what->stride); | 1187 in_what->stride); |
| 959 } | 1188 } |
| 960 } | 1189 } |
| 961 } else { | 1190 } else { |
| 962 if (use_mvcost) { | 1191 if (use_mvcost) { |
| 963 for (i = 0; i < 4; i++) { | 1192 for (i = 0; i < 4; i++) { |
| 964 const MV this_mv = {br + neighbors[i].row, | 1193 const MV this_mv = {br + neighbors[i].row, |
| 965 bc + neighbors[i].col}; | 1194 bc + neighbors[i].col}; |
| 966 if (sad_list[i + 1] != INT_MAX) { | 1195 if (cost_list[i + 1] != INT_MAX) { |
| 967 sad_list[i + 1] += | 1196 cost_list[i + 1] += |
| 968 mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit); | 1197 mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit); |
| 969 } | 1198 } |
| 970 } | 1199 } |
| 971 } | 1200 } |
| 972 } | 1201 } |
| 973 } | 1202 } |
| 974 best_mv->row = br; | 1203 best_mv->row = br; |
| 975 best_mv->col = bc; | 1204 best_mv->col = bc; |
| 976 return bestsad; | 1205 return bestsad; |
| 977 } | 1206 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1007 what->buf, what->stride, &unused, second_pred) + | 1236 what->buf, what->stride, &unused, second_pred) + |
| 1008 (use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, | 1237 (use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, |
| 1009 x->mvcost, x->errorperbit) : 0); | 1238 x->mvcost, x->errorperbit) : 0); |
| 1010 } | 1239 } |
| 1011 | 1240 |
| 1012 int vp9_hex_search(const MACROBLOCK *x, | 1241 int vp9_hex_search(const MACROBLOCK *x, |
| 1013 MV *ref_mv, | 1242 MV *ref_mv, |
| 1014 int search_param, | 1243 int search_param, |
| 1015 int sad_per_bit, | 1244 int sad_per_bit, |
| 1016 int do_init_search, | 1245 int do_init_search, |
| 1017 int *sad_list, | 1246 int *cost_list, |
| 1018 const vp9_variance_fn_ptr_t *vfp, | 1247 const vp9_variance_fn_ptr_t *vfp, |
| 1019 int use_mvcost, | 1248 int use_mvcost, |
| 1020 const MV *center_mv, MV *best_mv) { | 1249 const MV *center_mv, MV *best_mv) { |
| 1021 // First scale has 8-closest points, the rest have 6 points in hex shape | 1250 // First scale has 8-closest points, the rest have 6 points in hex shape |
| 1022 // at increasing scales | 1251 // at increasing scales |
| 1023 static const int hex_num_candidates[MAX_PATTERN_SCALES] = { | 1252 static const int hex_num_candidates[MAX_PATTERN_SCALES] = { |
| 1024 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 | 1253 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 |
| 1025 }; | 1254 }; |
| 1026 // Note that the largest candidate step at each scale is 2^scale | 1255 // Note that the largest candidate step at each scale is 2^scale |
| 1027 static const MV hex_candidates[MAX_PATTERN_SCALES][MAX_PATTERN_CANDIDATES] = { | 1256 static const MV hex_candidates[MAX_PATTERN_SCALES][MAX_PATTERN_CANDIDATES] = { |
| 1028 {{-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, { 0, 1}, { -1, 1}, {-1, 0}}, | 1257 {{-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, { 0, 1}, { -1, 1}, {-1, 0}}, |
| 1029 {{-1, -2}, {1, -2}, {2, 0}, {1, 2}, { -1, 2}, { -2, 0}}, | 1258 {{-1, -2}, {1, -2}, {2, 0}, {1, 2}, { -1, 2}, { -2, 0}}, |
| 1030 {{-2, -4}, {2, -4}, {4, 0}, {2, 4}, { -2, 4}, { -4, 0}}, | 1259 {{-2, -4}, {2, -4}, {4, 0}, {2, 4}, { -2, 4}, { -4, 0}}, |
| 1031 {{-4, -8}, {4, -8}, {8, 0}, {4, 8}, { -4, 8}, { -8, 0}}, | 1260 {{-4, -8}, {4, -8}, {8, 0}, {4, 8}, { -4, 8}, { -8, 0}}, |
| 1032 {{-8, -16}, {8, -16}, {16, 0}, {8, 16}, { -8, 16}, { -16, 0}}, | 1261 {{-8, -16}, {8, -16}, {16, 0}, {8, 16}, { -8, 16}, { -16, 0}}, |
| 1033 {{-16, -32}, {16, -32}, {32, 0}, {16, 32}, { -16, 32}, { -32, 0}}, | 1262 {{-16, -32}, {16, -32}, {32, 0}, {16, 32}, { -16, 32}, { -32, 0}}, |
| 1034 {{-32, -64}, {32, -64}, {64, 0}, {32, 64}, { -32, 64}, { -64, 0}}, | 1263 {{-32, -64}, {32, -64}, {64, 0}, {32, 64}, { -32, 64}, { -64, 0}}, |
| 1035 {{-64, -128}, {64, -128}, {128, 0}, {64, 128}, { -64, 128}, { -128, 0}}, | 1264 {{-64, -128}, {64, -128}, {128, 0}, {64, 128}, { -64, 128}, { -128, 0}}, |
| 1036 {{-128, -256}, {128, -256}, {256, 0}, {128, 256}, { -128, 256}, { -256, 0}}, | 1265 {{-128, -256}, {128, -256}, {256, 0}, {128, 256}, { -128, 256}, { -256, 0}}, |
| 1037 {{-256, -512}, {256, -512}, {512, 0}, {256, 512}, { -256, 512}, { -512, 0}}, | 1266 {{-256, -512}, {256, -512}, {512, 0}, {256, 512}, { -256, 512}, { -512, 0}}, |
| 1038 {{-512, -1024}, {512, -1024}, {1024, 0}, {512, 1024}, { -512, 1024}, | 1267 {{-512, -1024}, {512, -1024}, {1024, 0}, {512, 1024}, { -512, 1024}, |
| 1039 { -1024, 0}}, | 1268 { -1024, 0}}, |
| 1040 }; | 1269 }; |
| 1041 return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit, | 1270 return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit, |
| 1042 do_init_search, sad_list, vfp, use_mvcost, | 1271 do_init_search, cost_list, vfp, use_mvcost, |
| 1043 center_mv, best_mv, | 1272 center_mv, best_mv, |
| 1044 hex_num_candidates, hex_candidates); | 1273 hex_num_candidates, hex_candidates); |
| 1045 } | 1274 } |
| 1046 | 1275 |
| 1047 int vp9_bigdia_search(const MACROBLOCK *x, | 1276 int vp9_bigdia_search(const MACROBLOCK *x, |
| 1048 MV *ref_mv, | 1277 MV *ref_mv, |
| 1049 int search_param, | 1278 int search_param, |
| 1050 int sad_per_bit, | 1279 int sad_per_bit, |
| 1051 int do_init_search, | 1280 int do_init_search, |
| 1052 int *sad_list, | 1281 int *cost_list, |
| 1053 const vp9_variance_fn_ptr_t *vfp, | 1282 const vp9_variance_fn_ptr_t *vfp, |
| 1054 int use_mvcost, | 1283 int use_mvcost, |
| 1055 const MV *center_mv, | 1284 const MV *center_mv, |
| 1056 MV *best_mv) { | 1285 MV *best_mv) { |
| 1057 // First scale has 4-closest points, the rest have 8 points in diamond | 1286 // First scale has 4-closest points, the rest have 8 points in diamond |
| 1058 // shape at increasing scales | 1287 // shape at increasing scales |
| 1059 static const int bigdia_num_candidates[MAX_PATTERN_SCALES] = { | 1288 static const int bigdia_num_candidates[MAX_PATTERN_SCALES] = { |
| 1060 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | 1289 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
| 1061 }; | 1290 }; |
| 1062 // Note that the largest candidate step at each scale is 2^scale | 1291 // Note that the largest candidate step at each scale is 2^scale |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1074 {{-64, -64}, {0, -128}, {64, -64}, {128, 0}, {64, 64}, {0, 128}, | 1303 {{-64, -64}, {0, -128}, {64, -64}, {128, 0}, {64, 64}, {0, 128}, |
| 1075 {-64, 64}, {-128, 0}}, | 1304 {-64, 64}, {-128, 0}}, |
| 1076 {{-128, -128}, {0, -256}, {128, -128}, {256, 0}, {128, 128}, {0, 256}, | 1305 {{-128, -128}, {0, -256}, {128, -128}, {256, 0}, {128, 128}, {0, 256}, |
| 1077 {-128, 128}, {-256, 0}}, | 1306 {-128, 128}, {-256, 0}}, |
| 1078 {{-256, -256}, {0, -512}, {256, -256}, {512, 0}, {256, 256}, {0, 512}, | 1307 {{-256, -256}, {0, -512}, {256, -256}, {512, 0}, {256, 256}, {0, 512}, |
| 1079 {-256, 256}, {-512, 0}}, | 1308 {-256, 256}, {-512, 0}}, |
| 1080 {{-512, -512}, {0, -1024}, {512, -512}, {1024, 0}, {512, 512}, {0, 1024}, | 1309 {{-512, -512}, {0, -1024}, {512, -512}, {1024, 0}, {512, 512}, {0, 1024}, |
| 1081 {-512, 512}, {-1024, 0}}, | 1310 {-512, 512}, {-1024, 0}}, |
| 1082 }; | 1311 }; |
| 1083 return vp9_pattern_search_sad(x, ref_mv, search_param, sad_per_bit, | 1312 return vp9_pattern_search_sad(x, ref_mv, search_param, sad_per_bit, |
| 1084 do_init_search, sad_list, vfp, use_mvcost, | 1313 do_init_search, cost_list, vfp, use_mvcost, |
| 1085 center_mv, best_mv, | 1314 center_mv, best_mv, |
| 1086 bigdia_num_candidates, bigdia_candidates); | 1315 bigdia_num_candidates, bigdia_candidates); |
| 1087 } | 1316 } |
| 1088 | 1317 |
| 1089 int vp9_square_search(const MACROBLOCK *x, | 1318 int vp9_square_search(const MACROBLOCK *x, |
| 1090 MV *ref_mv, | 1319 MV *ref_mv, |
| 1091 int search_param, | 1320 int search_param, |
| 1092 int sad_per_bit, | 1321 int sad_per_bit, |
| 1093 int do_init_search, | 1322 int do_init_search, |
| 1094 int *sad_list, | 1323 int *cost_list, |
| 1095 const vp9_variance_fn_ptr_t *vfp, | 1324 const vp9_variance_fn_ptr_t *vfp, |
| 1096 int use_mvcost, | 1325 int use_mvcost, |
| 1097 const MV *center_mv, | 1326 const MV *center_mv, |
| 1098 MV *best_mv) { | 1327 MV *best_mv) { |
| 1099 // All scales have 8 closest points in square shape | 1328 // All scales have 8 closest points in square shape |
| 1100 static const int square_num_candidates[MAX_PATTERN_SCALES] = { | 1329 static const int square_num_candidates[MAX_PATTERN_SCALES] = { |
| 1101 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | 1330 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
| 1102 }; | 1331 }; |
| 1103 // Note that the largest candidate step at each scale is 2^scale | 1332 // Note that the largest candidate step at each scale is 2^scale |
| 1104 static const MV square_candidates[MAX_PATTERN_SCALES] | 1333 static const MV square_candidates[MAX_PATTERN_SCALES] |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1116 {{-128, -128}, {0, -128}, {128, -128}, {128, 0}, {128, 128}, {0, 128}, | 1345 {{-128, -128}, {0, -128}, {128, -128}, {128, 0}, {128, 128}, {0, 128}, |
| 1117 {-128, 128}, {-128, 0}}, | 1346 {-128, 128}, {-128, 0}}, |
| 1118 {{-256, -256}, {0, -256}, {256, -256}, {256, 0}, {256, 256}, {0, 256}, | 1347 {{-256, -256}, {0, -256}, {256, -256}, {256, 0}, {256, 256}, {0, 256}, |
| 1119 {-256, 256}, {-256, 0}}, | 1348 {-256, 256}, {-256, 0}}, |
| 1120 {{-512, -512}, {0, -512}, {512, -512}, {512, 0}, {512, 512}, {0, 512}, | 1349 {{-512, -512}, {0, -512}, {512, -512}, {512, 0}, {512, 512}, {0, 512}, |
| 1121 {-512, 512}, {-512, 0}}, | 1350 {-512, 512}, {-512, 0}}, |
| 1122 {{-1024, -1024}, {0, -1024}, {1024, -1024}, {1024, 0}, {1024, 1024}, | 1351 {{-1024, -1024}, {0, -1024}, {1024, -1024}, {1024, 0}, {1024, 1024}, |
| 1123 {0, 1024}, {-1024, 1024}, {-1024, 0}}, | 1352 {0, 1024}, {-1024, 1024}, {-1024, 0}}, |
| 1124 }; | 1353 }; |
| 1125 return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit, | 1354 return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit, |
| 1126 do_init_search, sad_list, vfp, use_mvcost, | 1355 do_init_search, cost_list, vfp, use_mvcost, |
| 1127 center_mv, best_mv, | 1356 center_mv, best_mv, |
| 1128 square_num_candidates, square_candidates); | 1357 square_num_candidates, square_candidates); |
| 1129 } | 1358 } |
| 1130 | 1359 |
| 1131 int vp9_fast_hex_search(const MACROBLOCK *x, | 1360 int vp9_fast_hex_search(const MACROBLOCK *x, |
| 1132 MV *ref_mv, | 1361 MV *ref_mv, |
| 1133 int search_param, | 1362 int search_param, |
| 1134 int sad_per_bit, | 1363 int sad_per_bit, |
| 1135 int do_init_search, // must be zero for fast_hex | 1364 int do_init_search, // must be zero for fast_hex |
| 1136 int *sad_list, | 1365 int *cost_list, |
| 1137 const vp9_variance_fn_ptr_t *vfp, | 1366 const vp9_variance_fn_ptr_t *vfp, |
| 1138 int use_mvcost, | 1367 int use_mvcost, |
| 1139 const MV *center_mv, | 1368 const MV *center_mv, |
| 1140 MV *best_mv) { | 1369 MV *best_mv) { |
| 1141 return vp9_hex_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param), | 1370 return vp9_hex_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param), |
| 1142 sad_per_bit, do_init_search, sad_list, vfp, use_mvcost, | 1371 sad_per_bit, do_init_search, cost_list, vfp, use_mvcost, |
| 1143 center_mv, best_mv); | 1372 center_mv, best_mv); |
| 1144 } | 1373 } |
| 1145 | 1374 |
| 1146 int vp9_fast_dia_search(const MACROBLOCK *x, | 1375 int vp9_fast_dia_search(const MACROBLOCK *x, |
| 1147 MV *ref_mv, | 1376 MV *ref_mv, |
| 1148 int search_param, | 1377 int search_param, |
| 1149 int sad_per_bit, | 1378 int sad_per_bit, |
| 1150 int do_init_search, | 1379 int do_init_search, |
| 1151 int *sad_list, | 1380 int *cost_list, |
| 1152 const vp9_variance_fn_ptr_t *vfp, | 1381 const vp9_variance_fn_ptr_t *vfp, |
| 1153 int use_mvcost, | 1382 int use_mvcost, |
| 1154 const MV *center_mv, | 1383 const MV *center_mv, |
| 1155 MV *best_mv) { | 1384 MV *best_mv) { |
| 1156 return vp9_bigdia_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param), | 1385 return vp9_bigdia_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param), |
| 1157 sad_per_bit, do_init_search, sad_list, vfp, | 1386 sad_per_bit, do_init_search, cost_list, vfp, |
| 1158 use_mvcost, center_mv, best_mv); | 1387 use_mvcost, center_mv, best_mv); |
| 1159 } | 1388 } |
| 1160 | 1389 |
| 1161 #undef CHECK_BETTER | 1390 #undef CHECK_BETTER |
| 1162 | 1391 |
| 1163 int vp9_full_range_search_c(const MACROBLOCK *x, | 1392 int vp9_full_range_search_c(const MACROBLOCK *x, |
| 1164 const search_site_config *cfg, | 1393 const search_site_config *cfg, |
| 1165 MV *ref_mv, MV *best_mv, | 1394 MV *ref_mv, MV *best_mv, |
| 1166 int search_param, int sad_per_bit, int *num00, | 1395 int search_param, int sad_per_bit, int *num00, |
| 1167 const vp9_variance_fn_ptr_t *fn_ptr, | 1396 const vp9_variance_fn_ptr_t *fn_ptr, |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 } else if (best_address == in_what) { | 1600 } else if (best_address == in_what) { |
| 1372 (*num00)++; | 1601 (*num00)++; |
| 1373 } | 1602 } |
| 1374 } | 1603 } |
| 1375 return bestsad; | 1604 return bestsad; |
| 1376 } | 1605 } |
| 1377 | 1606 |
| 1378 /* do_refine: If last step (1-away) of n-step search doesn't pick the center | 1607 /* do_refine: If last step (1-away) of n-step search doesn't pick the center |
| 1379 point as the best match, we will do a final 1-away diamond | 1608 point as the best match, we will do a final 1-away diamond |
| 1380 refining search */ | 1609 refining search */ |
| 1381 | |
| 1382 int vp9_full_pixel_diamond(const VP9_COMP *cpi, MACROBLOCK *x, | 1610 int vp9_full_pixel_diamond(const VP9_COMP *cpi, MACROBLOCK *x, |
| 1383 MV *mvp_full, int step_param, | 1611 MV *mvp_full, int step_param, |
| 1384 int sadpb, int further_steps, int do_refine, | 1612 int sadpb, int further_steps, int do_refine, |
| 1613 int *cost_list, |
| 1385 const vp9_variance_fn_ptr_t *fn_ptr, | 1614 const vp9_variance_fn_ptr_t *fn_ptr, |
| 1386 const MV *ref_mv, MV *dst_mv) { | 1615 const MV *ref_mv, MV *dst_mv) { |
| 1387 MV temp_mv; | 1616 MV temp_mv; |
| 1388 int thissme, n, num00 = 0; | 1617 int thissme, n, num00 = 0; |
| 1389 int bestsme = cpi->diamond_search_sad(x, &cpi->ss_cfg, mvp_full, &temp_mv, | 1618 int bestsme = cpi->diamond_search_sad(x, &cpi->ss_cfg, mvp_full, &temp_mv, |
| 1390 step_param, sadpb, &n, | 1619 step_param, sadpb, &n, |
| 1391 fn_ptr, ref_mv); | 1620 fn_ptr, ref_mv); |
| 1392 if (bestsme < INT_MAX) | 1621 if (bestsme < INT_MAX) |
| 1393 bestsme = vp9_get_mvpred_var(x, &temp_mv, ref_mv, fn_ptr, 1); | 1622 bestsme = vp9_get_mvpred_var(x, &temp_mv, ref_mv, fn_ptr, 1); |
| 1394 *dst_mv = temp_mv; | 1623 *dst_mv = temp_mv; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 MV best_mv = *dst_mv; | 1656 MV best_mv = *dst_mv; |
| 1428 thissme = cpi->refining_search_sad(x, &best_mv, sadpb, search_range, | 1657 thissme = cpi->refining_search_sad(x, &best_mv, sadpb, search_range, |
| 1429 fn_ptr, ref_mv); | 1658 fn_ptr, ref_mv); |
| 1430 if (thissme < INT_MAX) | 1659 if (thissme < INT_MAX) |
| 1431 thissme = vp9_get_mvpred_var(x, &best_mv, ref_mv, fn_ptr, 1); | 1660 thissme = vp9_get_mvpred_var(x, &best_mv, ref_mv, fn_ptr, 1); |
| 1432 if (thissme < bestsme) { | 1661 if (thissme < bestsme) { |
| 1433 bestsme = thissme; | 1662 bestsme = thissme; |
| 1434 *dst_mv = best_mv; | 1663 *dst_mv = best_mv; |
| 1435 } | 1664 } |
| 1436 } | 1665 } |
| 1666 |
| 1667 // Return cost list. |
| 1668 if (cost_list) { |
| 1669 calc_int_cost_list(x, ref_mv, sadpb, fn_ptr, dst_mv, cost_list); |
| 1670 } |
| 1437 return bestsme; | 1671 return bestsme; |
| 1438 } | 1672 } |
| 1439 | 1673 |
| 1440 int vp9_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv, | 1674 int vp9_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv, |
| 1441 int sad_per_bit, int distance, | 1675 int sad_per_bit, int distance, |
| 1442 const vp9_variance_fn_ptr_t *fn_ptr, | 1676 const vp9_variance_fn_ptr_t *fn_ptr, |
| 1443 const MV *center_mv, MV *best_mv) { | 1677 const MV *center_mv, MV *best_mv) { |
| 1444 int r, c; | 1678 int r, c; |
| 1445 const MACROBLOCKD *const xd = &x->e_mbd; | 1679 const MACROBLOCKD *const xd = &x->e_mbd; |
| 1446 const struct buf_2d *const what = &x->plane[0].src; | 1680 const struct buf_2d *const what = &x->plane[0].src; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1746 ref_mv->row += neighbors[best_site].row; | 1980 ref_mv->row += neighbors[best_site].row; |
| 1747 ref_mv->col += neighbors[best_site].col; | 1981 ref_mv->col += neighbors[best_site].col; |
| 1748 } | 1982 } |
| 1749 } | 1983 } |
| 1750 return best_sad; | 1984 return best_sad; |
| 1751 } | 1985 } |
| 1752 | 1986 |
| 1753 int vp9_full_pixel_search(VP9_COMP *cpi, MACROBLOCK *x, | 1987 int vp9_full_pixel_search(VP9_COMP *cpi, MACROBLOCK *x, |
| 1754 BLOCK_SIZE bsize, MV *mvp_full, | 1988 BLOCK_SIZE bsize, MV *mvp_full, |
| 1755 int step_param, int error_per_bit, | 1989 int step_param, int error_per_bit, |
| 1756 int *sad_list, | 1990 int *cost_list, |
| 1757 const MV *ref_mv, MV *tmp_mv, | 1991 const MV *ref_mv, MV *tmp_mv, |
| 1758 int var_max, int rd) { | 1992 int var_max, int rd) { |
| 1759 const SPEED_FEATURES *const sf = &cpi->sf; | 1993 const SPEED_FEATURES *const sf = &cpi->sf; |
| 1760 const SEARCH_METHODS method = sf->mv.search_method; | 1994 const SEARCH_METHODS method = sf->mv.search_method; |
| 1761 vp9_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize]; | 1995 vp9_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize]; |
| 1762 int var = 0; | 1996 int var = 0; |
| 1763 if (sad_list) { | 1997 if (cost_list) { |
| 1764 sad_list[0] = INT_MAX; | 1998 cost_list[0] = INT_MAX; |
| 1765 sad_list[1] = INT_MAX; | 1999 cost_list[1] = INT_MAX; |
| 1766 sad_list[2] = INT_MAX; | 2000 cost_list[2] = INT_MAX; |
| 1767 sad_list[3] = INT_MAX; | 2001 cost_list[3] = INT_MAX; |
| 1768 sad_list[4] = INT_MAX; | 2002 cost_list[4] = INT_MAX; |
| 1769 } | 2003 } |
| 1770 | 2004 |
| 1771 switch (method) { | 2005 switch (method) { |
| 1772 case FAST_DIAMOND: | 2006 case FAST_DIAMOND: |
| 1773 var = vp9_fast_dia_search(x, mvp_full, step_param, error_per_bit, 0, | 2007 var = vp9_fast_dia_search(x, mvp_full, step_param, error_per_bit, 0, |
| 1774 sad_list, fn_ptr, 1, ref_mv, tmp_mv); | 2008 cost_list, fn_ptr, 1, ref_mv, tmp_mv); |
| 1775 break; | 2009 break; |
| 1776 case FAST_HEX: | 2010 case FAST_HEX: |
| 1777 var = vp9_fast_hex_search(x, mvp_full, step_param, error_per_bit, 0, | 2011 var = vp9_fast_hex_search(x, mvp_full, step_param, error_per_bit, 0, |
| 1778 sad_list, fn_ptr, 1, ref_mv, tmp_mv); | 2012 cost_list, fn_ptr, 1, ref_mv, tmp_mv); |
| 1779 break; | 2013 break; |
| 1780 case HEX: | 2014 case HEX: |
| 1781 var = vp9_hex_search(x, mvp_full, step_param, error_per_bit, 1, | 2015 var = vp9_hex_search(x, mvp_full, step_param, error_per_bit, 1, |
| 1782 sad_list, fn_ptr, 1, ref_mv, tmp_mv); | 2016 cost_list, fn_ptr, 1, ref_mv, tmp_mv); |
| 1783 break; | 2017 break; |
| 1784 case SQUARE: | 2018 case SQUARE: |
| 1785 var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1, | 2019 var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1, |
| 1786 sad_list, fn_ptr, 1, ref_mv, tmp_mv); | 2020 cost_list, fn_ptr, 1, ref_mv, tmp_mv); |
| 1787 break; | 2021 break; |
| 1788 case BIGDIA: | 2022 case BIGDIA: |
| 1789 var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1, | 2023 var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1, |
| 1790 sad_list, fn_ptr, 1, ref_mv, tmp_mv); | 2024 cost_list, fn_ptr, 1, ref_mv, tmp_mv); |
| 1791 break; | 2025 break; |
| 1792 case NSTEP: | 2026 case NSTEP: |
| 1793 var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit, | 2027 var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit, |
| 1794 MAX_MVSEARCH_STEPS - 1 - step_param, | 2028 MAX_MVSEARCH_STEPS - 1 - step_param, |
| 1795 1, fn_ptr, ref_mv, tmp_mv); | 2029 1, cost_list, fn_ptr, ref_mv, tmp_mv); |
| 1796 break; | 2030 break; |
| 1797 default: | 2031 default: |
| 1798 assert(!"Invalid search method."); | 2032 assert(!"Invalid search method."); |
| 1799 } | 2033 } |
| 1800 | 2034 |
| 1801 if (method != NSTEP && rd && var < var_max) | 2035 if (method != NSTEP && rd && var < var_max) |
| 1802 var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1); | 2036 var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1); |
| 1803 | 2037 |
| 1804 return var; | 2038 return var; |
| 1805 } | 2039 } |
| OLD | NEW |