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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 sum_2_variances(node.split[1], node.split[3], &node.part_variances->vert[1]); | 394 sum_2_variances(node.split[1], node.split[3], &node.part_variances->vert[1]); |
395 sum_2_variances(&node.part_variances->vert[0], &node.part_variances->vert[1], | 395 sum_2_variances(&node.part_variances->vert[0], &node.part_variances->vert[1], |
396 &node.part_variances->none); | 396 &node.part_variances->none); |
397 } | 397 } |
398 | 398 |
399 static int set_vt_partitioning(VP9_COMP *cpi, | 399 static int set_vt_partitioning(VP9_COMP *cpi, |
400 MACROBLOCKD *const xd, | 400 MACROBLOCKD *const xd, |
401 void *data, | 401 void *data, |
402 BLOCK_SIZE bsize, | 402 BLOCK_SIZE bsize, |
403 int mi_row, | 403 int mi_row, |
404 int mi_col) { | 404 int mi_col, |
| 405 int64_t threshold, |
| 406 BLOCK_SIZE bsize_min, |
| 407 int segment_id) { |
405 VP9_COMMON * const cm = &cpi->common; | 408 VP9_COMMON * const cm = &cpi->common; |
406 variance_node vt; | 409 variance_node vt; |
407 const int block_width = num_8x8_blocks_wide_lookup[bsize]; | 410 const int block_width = num_8x8_blocks_wide_lookup[bsize]; |
408 const int block_height = num_8x8_blocks_high_lookup[bsize]; | 411 const int block_height = num_8x8_blocks_high_lookup[bsize]; |
409 // TODO(marpan): Adjust/tune these thresholds. | |
410 const int threshold_multiplier = cm->frame_type == KEY_FRAME ? 80 : 4; | |
411 int64_t threshold = | |
412 (int64_t)(threshold_multiplier * | |
413 vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth)); | |
414 int64_t threshold_bsize_ref = threshold << 6; | |
415 int64_t threshold_low = threshold; | |
416 BLOCK_SIZE bsize_ref = BLOCK_16X16; | |
417 | 412 |
418 assert(block_height == block_width); | 413 assert(block_height == block_width); |
419 tree_to_node(data, bsize, &vt); | 414 tree_to_node(data, bsize, &vt); |
420 | 415 |
421 if (cm->frame_type == KEY_FRAME) { | 416 // No 64x64 blocks on segments other than base (un-boosted) segment. |
422 bsize_ref = BLOCK_8X8; | 417 if (segment_id != CR_SEGMENT_ID_BASE && bsize == BLOCK_64X64) |
423 // Choose lower thresholds for key frame variance to favor split, but keep | 418 return 0; |
424 // threshold for splitting to 4x4 block still fairly high for now. | |
425 threshold_bsize_ref = threshold << 2; | |
426 threshold_low = threshold >> 2; | |
427 } | |
428 | 419 |
429 // For bsize=bsize_ref (16x16/8x8 for 8x8/4x4 downsampling), select if | 420 // For bsize=bsize_min (16x16/8x8 for 8x8/4x4 downsampling), select if |
430 // variance is below threshold, otherwise split will be selected. | 421 // variance is below threshold, otherwise split will be selected. |
431 // No check for vert/horiz split as too few samples for variance. | 422 // No check for vert/horiz split as too few samples for variance. |
432 if (bsize == bsize_ref) { | 423 if (bsize == bsize_min) { |
433 get_variance(&vt.part_variances->none); | 424 get_variance(&vt.part_variances->none); |
434 if (mi_col + block_width / 2 < cm->mi_cols && | 425 if (mi_col + block_width / 2 < cm->mi_cols && |
435 mi_row + block_height / 2 < cm->mi_rows && | 426 mi_row + block_height / 2 < cm->mi_rows && |
436 vt.part_variances->none.variance < threshold_bsize_ref) { | 427 vt.part_variances->none.variance < threshold) { |
437 set_block_size(cpi, xd, mi_row, mi_col, bsize); | 428 set_block_size(cpi, xd, mi_row, mi_col, bsize); |
438 return 1; | 429 return 1; |
439 } | 430 } |
440 return 0; | 431 return 0; |
441 } else if (bsize > bsize_ref) { | 432 } else if (bsize > bsize_min) { |
442 get_variance(&vt.part_variances->none); | 433 get_variance(&vt.part_variances->none); |
443 // For key frame, for bsize above 32X32, or very high variance, take split. | 434 // For key frame or low_res: for bsize above 32X32 or very high variance, |
| 435 // take split. |
444 if (cm->frame_type == KEY_FRAME && | 436 if (cm->frame_type == KEY_FRAME && |
445 (bsize > BLOCK_32X32 || | 437 (bsize > BLOCK_32X32 || |
446 vt.part_variances->none.variance > (threshold << 2))) { | 438 vt.part_variances->none.variance > (threshold << 4))) { |
447 return 0; | 439 return 0; |
448 } | 440 } |
449 // If variance is low, take the bsize (no split). | 441 // If variance is low, take the bsize (no split). |
450 if (mi_col + block_width / 2 < cm->mi_cols && | 442 if (mi_col + block_width / 2 < cm->mi_cols && |
451 mi_row + block_height / 2 < cm->mi_rows && | 443 mi_row + block_height / 2 < cm->mi_rows && |
452 vt.part_variances->none.variance < threshold_low) { | 444 vt.part_variances->none.variance < threshold) { |
453 set_block_size(cpi, xd, mi_row, mi_col, bsize); | 445 set_block_size(cpi, xd, mi_row, mi_col, bsize); |
454 return 1; | 446 return 1; |
455 } | 447 } |
456 | 448 |
457 // Check vertical split. | 449 // Check vertical split. |
458 if (mi_row + block_height / 2 < cm->mi_rows) { | 450 if (mi_row + block_height / 2 < cm->mi_rows) { |
459 get_variance(&vt.part_variances->vert[0]); | 451 get_variance(&vt.part_variances->vert[0]); |
460 get_variance(&vt.part_variances->vert[1]); | 452 get_variance(&vt.part_variances->vert[1]); |
461 if (vt.part_variances->vert[0].variance < threshold_low && | 453 if (vt.part_variances->vert[0].variance < threshold && |
462 vt.part_variances->vert[1].variance < threshold_low) { | 454 vt.part_variances->vert[1].variance < threshold) { |
463 BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_VERT); | 455 BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_VERT); |
464 set_block_size(cpi, xd, mi_row, mi_col, subsize); | 456 set_block_size(cpi, xd, mi_row, mi_col, subsize); |
465 set_block_size(cpi, xd, mi_row, mi_col + block_width / 2, subsize); | 457 set_block_size(cpi, xd, mi_row, mi_col + block_width / 2, subsize); |
466 return 1; | 458 return 1; |
467 } | 459 } |
468 } | 460 } |
469 // Check horizontal split. | 461 // Check horizontal split. |
470 if (mi_col + block_width / 2 < cm->mi_cols) { | 462 if (mi_col + block_width / 2 < cm->mi_cols) { |
471 get_variance(&vt.part_variances->horz[0]); | 463 get_variance(&vt.part_variances->horz[0]); |
472 get_variance(&vt.part_variances->horz[1]); | 464 get_variance(&vt.part_variances->horz[1]); |
473 if (vt.part_variances->horz[0].variance < threshold_low && | 465 if (vt.part_variances->horz[0].variance < threshold && |
474 vt.part_variances->horz[1].variance < threshold_low) { | 466 vt.part_variances->horz[1].variance < threshold) { |
475 BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_HORZ); | 467 BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_HORZ); |
476 set_block_size(cpi, xd, mi_row, mi_col, subsize); | 468 set_block_size(cpi, xd, mi_row, mi_col, subsize); |
477 set_block_size(cpi, xd, mi_row + block_height / 2, mi_col, subsize); | 469 set_block_size(cpi, xd, mi_row + block_height / 2, mi_col, subsize); |
478 return 1; | 470 return 1; |
479 } | 471 } |
480 } | 472 } |
481 | 473 |
482 return 0; | 474 return 0; |
483 } | 475 } |
484 return 0; | 476 return 0; |
485 } | 477 } |
486 | 478 |
| 479 |
| 480 void vp9_set_vbp_thresholds(VP9_COMP *cpi, int q) { |
| 481 SPEED_FEATURES *const sf = &cpi->sf; |
| 482 if (sf->partition_search_type != VAR_BASED_PARTITION) { |
| 483 return; |
| 484 } else { |
| 485 VP9_COMMON *const cm = &cpi->common; |
| 486 const VP9EncoderConfig *const oxcf = &cpi->oxcf; |
| 487 const int is_key_frame = (cm->frame_type == KEY_FRAME); |
| 488 const int use_4x4_partition = is_key_frame; |
| 489 const int low_res = (cm->width <= 352 && cm->height <= 288); |
| 490 const int threshold_multiplier = is_key_frame ? 80 : 4; |
| 491 const int64_t threshold_base = (int64_t)(threshold_multiplier * |
| 492 vp9_convert_qindex_to_q(q, cm->bit_depth)); |
| 493 cpi->vbp_threshold = threshold_base; |
| 494 cpi->vbp_threshold_bsize_min = threshold_base << oxcf->speed; |
| 495 cpi->vbp_threshold_bsize_max = threshold_base; |
| 496 |
| 497 if (is_key_frame) { |
| 498 cpi->vbp_threshold = threshold_base >> 2; |
| 499 cpi->vbp_threshold_bsize_min = threshold_base << 2; |
| 500 } else if (low_res) { |
| 501 cpi->vbp_threshold_bsize_min = threshold_base << 3; |
| 502 cpi->vbp_threshold_bsize_max = threshold_base >> 2; |
| 503 } |
| 504 // TODO(marpan): Allow 4x4 partitions for inter-frames. |
| 505 // use_4x4_partition = (variance4x4downsample[i2 + j] == 1); |
| 506 // If 4x4 partition is not used, then 8x8 partition will be selected |
| 507 // if variance of 16x16 block is very high, so use larger threshold |
| 508 // for 16x16 (threshold_bsize_min) in that case. |
| 509 cpi->vbp_threshold_16x16 = (use_4x4_partition) ? |
| 510 cpi->vbp_threshold : cpi->vbp_threshold_bsize_min; |
| 511 cpi->vbp_bsize_min = (use_4x4_partition) ? BLOCK_8X8 : BLOCK_16X16; |
| 512 } |
| 513 } |
| 514 |
| 515 #if CONFIG_VP9_HIGHBITDEPTH |
| 516 #define GLOBAL_MOTION 0 |
| 517 #else |
| 518 #define GLOBAL_MOTION 1 |
| 519 #endif |
| 520 |
| 521 #if GLOBAL_MOTION |
| 522 static int vector_match(int16_t *ref, int16_t *src) { |
| 523 int best_sad = INT_MAX; |
| 524 int this_sad; |
| 525 int d; |
| 526 int center, offset = 0; |
| 527 for (d = 0; d <= 64; d += 16) { |
| 528 this_sad = vp9_vector_sad(&ref[d], src, 64); |
| 529 if (this_sad < best_sad) { |
| 530 best_sad = this_sad; |
| 531 offset = d; |
| 532 } |
| 533 } |
| 534 center = offset; |
| 535 |
| 536 for (d = -8; d <= 8; d += 16) { |
| 537 int this_pos = offset + d; |
| 538 // check limit |
| 539 if (this_pos < 0 || this_pos > 64) |
| 540 continue; |
| 541 this_sad = vp9_vector_sad(&ref[this_pos], src, 64); |
| 542 if (this_sad < best_sad) { |
| 543 best_sad = this_sad; |
| 544 center = this_pos; |
| 545 } |
| 546 } |
| 547 offset = center; |
| 548 |
| 549 for (d = -4; d <= 4; d += 8) { |
| 550 int this_pos = offset + d; |
| 551 // check limit |
| 552 if (this_pos < 0 || this_pos > 64) |
| 553 continue; |
| 554 this_sad = vp9_vector_sad(&ref[this_pos], src, 64); |
| 555 if (this_sad < best_sad) { |
| 556 best_sad = this_sad; |
| 557 center = this_pos; |
| 558 } |
| 559 } |
| 560 offset = center; |
| 561 |
| 562 for (d = -2; d <= 2; d += 4) { |
| 563 int this_pos = offset + d; |
| 564 // check limit |
| 565 if (this_pos < 0 || this_pos > 64) |
| 566 continue; |
| 567 this_sad = vp9_vector_sad(&ref[this_pos], src, 64); |
| 568 if (this_sad < best_sad) { |
| 569 best_sad = this_sad; |
| 570 center = this_pos; |
| 571 } |
| 572 } |
| 573 offset = center; |
| 574 |
| 575 for (d = -1; d <= 1; d += 2) { |
| 576 int this_pos = offset + d; |
| 577 // check limit |
| 578 if (this_pos < 0 || this_pos > 64) |
| 579 continue; |
| 580 this_sad = vp9_vector_sad(&ref[this_pos], src, 64); |
| 581 if (this_sad < best_sad) { |
| 582 best_sad = this_sad; |
| 583 center = this_pos; |
| 584 } |
| 585 } |
| 586 |
| 587 return (center - 32); |
| 588 } |
| 589 |
| 590 static const MV search_pos[9] = { |
| 591 {-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 0}, {0, 1}, |
| 592 {1, -1}, {1, 0}, {1, 1}, |
| 593 }; |
| 594 |
| 595 static void motion_estimation(VP9_COMP *cpi, MACROBLOCK *x) { |
| 596 MACROBLOCKD *xd = &x->e_mbd; |
| 597 DECLARE_ALIGNED(16, int16_t, hbuf[128]); |
| 598 DECLARE_ALIGNED(16, int16_t, vbuf[128]); |
| 599 DECLARE_ALIGNED(16, int16_t, src_hbuf[64]); |
| 600 DECLARE_ALIGNED(16, int16_t, src_vbuf[64]); |
| 601 int idx; |
| 602 const int stride = 64; |
| 603 const int search_width = 128; |
| 604 const int search_height = 128; |
| 605 const int src_stride = x->plane[0].src.stride; |
| 606 const int ref_stride = xd->plane[0].pre[0].stride; |
| 607 uint8_t const *ref_buf, *src_buf; |
| 608 MV *tmp_mv = &xd->mi[0].src_mi->mbmi.mv[0].as_mv; |
| 609 int best_sad; |
| 610 MV this_mv; |
| 611 |
| 612 // Set up prediction 1-D reference set |
| 613 ref_buf = xd->plane[0].pre[0].buf + (-32); |
| 614 for (idx = 0; idx < search_width; idx += 16) { |
| 615 vp9_int_pro_row(&hbuf[idx], ref_buf, ref_stride, 64); |
| 616 ref_buf += 16; |
| 617 } |
| 618 |
| 619 ref_buf = xd->plane[0].pre[0].buf + (-32) * ref_stride; |
| 620 for (idx = 0; idx < search_height; ++idx) { |
| 621 vbuf[idx] = vp9_int_pro_col(ref_buf, 64); |
| 622 ref_buf += ref_stride; |
| 623 } |
| 624 |
| 625 // Set up src 1-D reference set |
| 626 for (idx = 0; idx < stride; idx += 16) { |
| 627 src_buf = x->plane[0].src.buf + idx; |
| 628 vp9_int_pro_row(&src_hbuf[idx], src_buf, src_stride, 64); |
| 629 } |
| 630 |
| 631 src_buf = x->plane[0].src.buf; |
| 632 for (idx = 0; idx < stride; ++idx) { |
| 633 src_vbuf[idx] = vp9_int_pro_col(src_buf, 64); |
| 634 src_buf += src_stride; |
| 635 } |
| 636 |
| 637 // Find the best match per 1-D search |
| 638 |
| 639 tmp_mv->col = vector_match(hbuf, src_hbuf); |
| 640 tmp_mv->row = vector_match(vbuf, src_vbuf); |
| 641 |
| 642 best_sad = INT_MAX; |
| 643 this_mv = *tmp_mv; |
| 644 for (idx = 0; idx < 9; ++idx) { |
| 645 int this_sad; |
| 646 src_buf = x->plane[0].src.buf; |
| 647 ref_buf = xd->plane[0].pre[0].buf + |
| 648 (search_pos[idx].row + this_mv.row) * ref_stride + |
| 649 (search_pos[idx].col + this_mv.col); |
| 650 |
| 651 this_sad = cpi->fn_ptr[BLOCK_64X64].sdf(src_buf, src_stride, |
| 652 ref_buf, ref_stride); |
| 653 if (this_sad < best_sad) { |
| 654 best_sad = this_sad; |
| 655 tmp_mv->row = search_pos[idx].row + this_mv.row; |
| 656 tmp_mv->col = search_pos[idx].col + this_mv.col; |
| 657 } |
| 658 } |
| 659 |
| 660 tmp_mv->row *= 8; |
| 661 tmp_mv->col *= 8; |
| 662 |
| 663 x->pred_mv[LAST_FRAME] = *tmp_mv; |
| 664 } |
| 665 #endif |
| 666 |
487 // This function chooses partitioning based on the variance between source and | 667 // This function chooses partitioning based on the variance between source and |
488 // reconstructed last, where variance is computed for downsampled inputs. | 668 // reconstructed last, where variance is computed for downs-sampled inputs. |
489 // Currently 8x8 downsampling is used for delta frames, 4x4 for key frames. | |
490 static void choose_partitioning(VP9_COMP *cpi, | 669 static void choose_partitioning(VP9_COMP *cpi, |
491 const TileInfo *const tile, | 670 const TileInfo *const tile, |
492 MACROBLOCK *x, | 671 MACROBLOCK *x, |
493 int mi_row, int mi_col) { | 672 int mi_row, int mi_col) { |
494 VP9_COMMON * const cm = &cpi->common; | 673 VP9_COMMON * const cm = &cpi->common; |
495 MACROBLOCKD *xd = &x->e_mbd; | 674 MACROBLOCKD *xd = &x->e_mbd; |
496 | |
497 int i, j, k, m; | 675 int i, j, k, m; |
498 v64x64 vt; | 676 v64x64 vt; |
| 677 v16x16 vt2[16]; |
499 uint8_t *s; | 678 uint8_t *s; |
500 const uint8_t *d; | 679 const uint8_t *d; |
501 int sp; | 680 int sp; |
502 int dp; | 681 int dp; |
503 int pixels_wide = 64, pixels_high = 64; | 682 int pixels_wide = 64, pixels_high = 64; |
504 const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME); | 683 const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME); |
505 const struct scale_factors *const sf = &cm->frame_refs[LAST_FRAME - 1].sf; | 684 |
506 | 685 // Always use 4x4 partition for key frame. |
507 vp9_clear_system_state(); | 686 const int is_key_frame = (cm->frame_type == KEY_FRAME); |
| 687 const int use_4x4_partition = is_key_frame; |
| 688 const int low_res = (cm->width <= 352 && cm->height <= 288); |
| 689 int variance4x4downsample[16]; |
| 690 |
| 691 int segment_id = CR_SEGMENT_ID_BASE; |
| 692 if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled) { |
| 693 const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map : |
| 694 cm->last_frame_seg_map; |
| 695 segment_id = vp9_get_segment_id(cm, map, BLOCK_64X64, mi_row, mi_col); |
| 696 } |
| 697 |
508 set_offsets(cpi, tile, x, mi_row, mi_col, BLOCK_64X64); | 698 set_offsets(cpi, tile, x, mi_row, mi_col, BLOCK_64X64); |
509 | 699 |
510 if (xd->mb_to_right_edge < 0) | 700 if (xd->mb_to_right_edge < 0) |
511 pixels_wide += (xd->mb_to_right_edge >> 3); | 701 pixels_wide += (xd->mb_to_right_edge >> 3); |
512 if (xd->mb_to_bottom_edge < 0) | 702 if (xd->mb_to_bottom_edge < 0) |
513 pixels_high += (xd->mb_to_bottom_edge >> 3); | 703 pixels_high += (xd->mb_to_bottom_edge >> 3); |
514 | 704 |
515 s = x->plane[0].src.buf; | 705 s = x->plane[0].src.buf; |
516 sp = x->plane[0].src.stride; | 706 sp = x->plane[0].src.stride; |
517 | 707 |
518 if (cm->frame_type != KEY_FRAME) { | 708 if (!is_key_frame) { |
519 vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col, sf); | 709 MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi; |
| 710 unsigned int var = 0, sse; |
| 711 vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col, |
| 712 &cm->frame_refs[LAST_FRAME - 1].sf); |
| 713 mbmi->ref_frame[0] = LAST_FRAME; |
| 714 mbmi->ref_frame[1] = NONE; |
| 715 mbmi->sb_type = BLOCK_64X64; |
| 716 mbmi->mv[0].as_int = 0; |
| 717 mbmi->interp_filter = BILINEAR; |
520 | 718 |
521 xd->mi[0].src_mi->mbmi.ref_frame[0] = LAST_FRAME; | 719 #if GLOBAL_MOTION |
522 xd->mi[0].src_mi->mbmi.sb_type = BLOCK_64X64; | 720 motion_estimation(cpi, x); |
523 xd->mi[0].src_mi->mbmi.mv[0].as_int = 0; | 721 #endif |
524 vp9_build_inter_predictors_sby(xd, mi_row, mi_col, BLOCK_64X64); | 722 |
| 723 vp9_build_inter_predictors_sb(xd, mi_row, mi_col, BLOCK_64X64); |
| 724 |
| 725 for (i = 1; i <= 2; ++i) { |
| 726 struct macroblock_plane *p = &x->plane[i]; |
| 727 struct macroblockd_plane *pd = &xd->plane[i]; |
| 728 const BLOCK_SIZE bs = get_plane_block_size(BLOCK_64X64, pd); |
| 729 var += cpi->fn_ptr[bs].vf(p->src.buf, p->src.stride, |
| 730 pd->dst.buf, pd->dst.stride, &sse); |
| 731 if (sse > 2048) |
| 732 x->color_sensitivity[i - 1] = 1; |
| 733 } |
525 | 734 |
526 d = xd->plane[0].dst.buf; | 735 d = xd->plane[0].dst.buf; |
527 dp = xd->plane[0].dst.stride; | 736 dp = xd->plane[0].dst.stride; |
528 } else { | 737 } else { |
529 d = VP9_VAR_OFFS; | 738 d = VP9_VAR_OFFS; |
530 dp = 0; | 739 dp = 0; |
531 #if CONFIG_VP9_HIGHBITDEPTH | 740 #if CONFIG_VP9_HIGHBITDEPTH |
532 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { | 741 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { |
533 switch (xd->bd) { | 742 switch (xd->bd) { |
534 case 10: | 743 case 10: |
535 d = CONVERT_TO_BYTEPTR(VP9_HIGH_VAR_OFFS_10); | 744 d = CONVERT_TO_BYTEPTR(VP9_HIGH_VAR_OFFS_10); |
536 break; | 745 break; |
537 case 12: | 746 case 12: |
538 d = CONVERT_TO_BYTEPTR(VP9_HIGH_VAR_OFFS_12); | 747 d = CONVERT_TO_BYTEPTR(VP9_HIGH_VAR_OFFS_12); |
539 break; | 748 break; |
540 case 8: | 749 case 8: |
541 default: | 750 default: |
542 d = CONVERT_TO_BYTEPTR(VP9_HIGH_VAR_OFFS_8); | 751 d = CONVERT_TO_BYTEPTR(VP9_HIGH_VAR_OFFS_8); |
543 break; | 752 break; |
544 } | 753 } |
545 } | 754 } |
546 #endif // CONFIG_VP9_HIGHBITDEPTH | 755 #endif // CONFIG_VP9_HIGHBITDEPTH |
547 } | 756 } |
548 | 757 |
549 // Fill in the entire tree of 8x8 variances for splits. | 758 // Fill in the entire tree of 8x8 (or 4x4 under some conditions) variances |
| 759 // for splits. |
550 for (i = 0; i < 4; i++) { | 760 for (i = 0; i < 4; i++) { |
551 const int x32_idx = ((i & 1) << 5); | 761 const int x32_idx = ((i & 1) << 5); |
552 const int y32_idx = ((i >> 1) << 5); | 762 const int y32_idx = ((i >> 1) << 5); |
| 763 const int i2 = i << 2; |
553 for (j = 0; j < 4; j++) { | 764 for (j = 0; j < 4; j++) { |
554 const int x16_idx = x32_idx + ((j & 1) << 4); | 765 const int x16_idx = x32_idx + ((j & 1) << 4); |
555 const int y16_idx = y32_idx + ((j >> 1) << 4); | 766 const int y16_idx = y32_idx + ((j >> 1) << 4); |
556 v16x16 *vst = &vt.split[i].split[j]; | 767 v16x16 *vst = &vt.split[i].split[j]; |
557 for (k = 0; k < 4; k++) { | 768 variance4x4downsample[i2 + j] = 0; |
558 int x8_idx = x16_idx + ((k & 1) << 3); | 769 if (!is_key_frame) { |
559 int y8_idx = y16_idx + ((k >> 1) << 3); | 770 for (k = 0; k < 4; k++) { |
560 if (cm->frame_type != KEY_FRAME) { | 771 int x8_idx = x16_idx + ((k & 1) << 3); |
561 unsigned int sse = 0; | 772 int y8_idx = y16_idx + ((k >> 1) << 3); |
562 int sum = 0; | 773 unsigned int sse = 0; |
563 if (x8_idx < pixels_wide && y8_idx < pixels_high) { | 774 int sum = 0; |
564 int s_avg, d_avg; | 775 if (x8_idx < pixels_wide && y8_idx < pixels_high) { |
| 776 int s_avg, d_avg; |
565 #if CONFIG_VP9_HIGHBITDEPTH | 777 #if CONFIG_VP9_HIGHBITDEPTH |
566 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { | 778 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { |
567 s_avg = vp9_highbd_avg_8x8(s + y8_idx * sp + x8_idx, sp); | 779 s_avg = vp9_highbd_avg_8x8(s + y8_idx * sp + x8_idx, sp); |
568 d_avg = vp9_highbd_avg_8x8(d + y8_idx * dp + x8_idx, dp); | 780 d_avg = vp9_highbd_avg_8x8(d + y8_idx * dp + x8_idx, dp); |
569 } else { | 781 } else { |
| 782 s_avg = vp9_avg_8x8(s + y8_idx * sp + x8_idx, sp); |
| 783 d_avg = vp9_avg_8x8(d + y8_idx * dp + x8_idx, dp); |
| 784 } |
| 785 #else |
570 s_avg = vp9_avg_8x8(s + y8_idx * sp + x8_idx, sp); | 786 s_avg = vp9_avg_8x8(s + y8_idx * sp + x8_idx, sp); |
571 d_avg = vp9_avg_8x8(d + y8_idx * dp + x8_idx, dp); | 787 d_avg = vp9_avg_8x8(d + y8_idx * dp + x8_idx, dp); |
572 } | |
573 #else | |
574 s_avg = vp9_avg_8x8(s + y8_idx * sp + x8_idx, sp); | |
575 d_avg = vp9_avg_8x8(d + y8_idx * dp + x8_idx, dp); | |
576 #endif | 788 #endif |
577 sum = s_avg - d_avg; | 789 sum = s_avg - d_avg; |
578 sse = sum * sum; | 790 sse = sum * sum; |
579 } | 791 } |
580 // If variance is based on 8x8 downsampling, we stop here and have | 792 // If variance is based on 8x8 downsampling, we stop here and have |
581 // one sample for 8x8 block (so use 1 for count in fill_variance), | 793 // one sample for 8x8 block (so use 1 for count in fill_variance), |
582 // which of course means variance = 0 for 8x8 block. | 794 // which of course means variance = 0 for 8x8 block. |
583 fill_variance(sse, sum, 0, &vst->split[k].part_variances.none); | 795 fill_variance(sse, sum, 0, &vst->split[k].part_variances.none); |
584 } else { | 796 } |
585 // For key frame, go down to 4x4. | 797 fill_variance_tree(&vt.split[i].split[j], BLOCK_16X16); |
586 v8x8 *vst2 = &vst->split[k]; | 798 // For low-resolution, compute the variance based on 8x8 down-sampling, |
| 799 // and if it is large (above the threshold) we go down for 4x4. |
| 800 // For key frame we always go down to 4x4. |
| 801 if (low_res) |
| 802 get_variance(&vt.split[i].split[j].part_variances.none); |
| 803 } |
| 804 if (is_key_frame || (low_res && |
| 805 vt.split[i].split[j].part_variances.none.variance > |
| 806 (cpi->vbp_threshold << 1))) { |
| 807 // Go down to 4x4 down-sampling for variance. |
| 808 variance4x4downsample[i2 + j] = 1; |
| 809 for (k = 0; k < 4; k++) { |
| 810 int x8_idx = x16_idx + ((k & 1) << 3); |
| 811 int y8_idx = y16_idx + ((k >> 1) << 3); |
| 812 v8x8 *vst2 = is_key_frame ? &vst->split[k] : |
| 813 &vt2[i2 + j].split[k]; |
587 for (m = 0; m < 4; m++) { | 814 for (m = 0; m < 4; m++) { |
588 int x4_idx = x8_idx + ((m & 1) << 2); | 815 int x4_idx = x8_idx + ((m & 1) << 2); |
589 int y4_idx = y8_idx + ((m >> 1) << 2); | 816 int y4_idx = y8_idx + ((m >> 1) << 2); |
590 unsigned int sse = 0; | 817 unsigned int sse = 0; |
591 int sum = 0; | 818 int sum = 0; |
592 if (x4_idx < pixels_wide && y4_idx < pixels_high) { | 819 if (x4_idx < pixels_wide && y4_idx < pixels_high) { |
| 820 int d_avg = 128; |
593 #if CONFIG_VP9_HIGHBITDEPTH | 821 #if CONFIG_VP9_HIGHBITDEPTH |
594 int s_avg; | 822 int s_avg; |
595 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { | 823 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { |
596 s_avg = vp9_highbd_avg_4x4(s + y4_idx * sp + x4_idx, sp); | 824 s_avg = vp9_highbd_avg_4x4(s + y4_idx * sp + x4_idx, sp); |
| 825 if (cm->frame_type != KEY_FRAME) |
| 826 d_avg = vp9_highbd_avg_4x4(d + y4_idx * dp + x4_idx, dp); |
597 } else { | 827 } else { |
598 s_avg = vp9_avg_4x4(s + y4_idx * sp + x4_idx, sp); | 828 s_avg = vp9_avg_4x4(s + y4_idx * sp + x4_idx, sp); |
| 829 if (cm->frame_type != KEY_FRAME) |
| 830 d_avg = vp9_avg_4x4(d + y4_idx * dp + x4_idx, dp); |
599 } | 831 } |
600 #else | 832 #else |
601 int s_avg = vp9_avg_4x4(s + y4_idx * sp + x4_idx, sp); | 833 int s_avg = vp9_avg_4x4(s + y4_idx * sp + x4_idx, sp); |
| 834 if (!is_key_frame) |
| 835 d_avg = vp9_avg_4x4(d + y4_idx * dp + x4_idx, dp); |
602 #endif | 836 #endif |
603 // For key frame, reference is set to 128. | 837 sum = s_avg - d_avg; |
604 sum = s_avg - 128; | |
605 sse = sum * sum; | 838 sse = sum * sum; |
606 } | 839 } |
607 // If variance is based on 4x4 downsampling, we stop here and have | 840 // If variance is based on 4x4 down-sampling, we stop here and have |
608 // one sample for 4x4 block (so use 1 for count in fill_variance), | 841 // one sample for 4x4 block (so use 1 for count in fill_variance), |
609 // which of course means variance = 0 for 4x4 block. | 842 // which of course means variance = 0 for 4x4 block. |
610 fill_variance(sse, sum, 0, &vst2->split[m].part_variances.none); | 843 fill_variance(sse, sum, 0, &vst2->split[m].part_variances.none); |
611 } | 844 } |
612 } | 845 } |
613 } | 846 } |
614 } | 847 } |
615 } | 848 } |
| 849 |
616 // Fill the rest of the variance tree by summing split partition values. | 850 // Fill the rest of the variance tree by summing split partition values. |
617 for (i = 0; i < 4; i++) { | 851 for (i = 0; i < 4; i++) { |
| 852 const int i2 = i << 2; |
618 for (j = 0; j < 4; j++) { | 853 for (j = 0; j < 4; j++) { |
619 if (cm->frame_type == KEY_FRAME) { | 854 if (variance4x4downsample[i2 + j] == 1) { |
| 855 v16x16 *vtemp = (!is_key_frame) ? &vt2[i2 + j] : |
| 856 &vt.split[i].split[j]; |
620 for (m = 0; m < 4; m++) { | 857 for (m = 0; m < 4; m++) { |
621 fill_variance_tree(&vt.split[i].split[j].split[m], BLOCK_8X8); | 858 fill_variance_tree(&vtemp->split[m], BLOCK_8X8); |
622 } | 859 } |
| 860 fill_variance_tree(vtemp, BLOCK_16X16); |
623 } | 861 } |
624 fill_variance_tree(&vt.split[i].split[j], BLOCK_16X16); | |
625 } | 862 } |
626 fill_variance_tree(&vt.split[i], BLOCK_32X32); | 863 fill_variance_tree(&vt.split[i], BLOCK_32X32); |
627 } | 864 } |
628 fill_variance_tree(&vt, BLOCK_64X64); | 865 fill_variance_tree(&vt, BLOCK_64X64); |
629 | 866 |
630 // Now go through the entire structure, splitting every block size until | 867 // Now go through the entire structure, splitting every block size until |
631 // we get to one that's got a variance lower than our threshold. | 868 // we get to one that's got a variance lower than our threshold. |
632 if ( mi_col + 8 > cm->mi_cols || mi_row + 8 > cm->mi_rows || | 869 if ( mi_col + 8 > cm->mi_cols || mi_row + 8 > cm->mi_rows || |
633 !set_vt_partitioning(cpi, xd, &vt, BLOCK_64X64, mi_row, mi_col)) { | 870 !set_vt_partitioning(cpi, xd, &vt, BLOCK_64X64, mi_row, mi_col, |
| 871 cpi->vbp_threshold_bsize_max, BLOCK_16X16, |
| 872 segment_id)) { |
634 for (i = 0; i < 4; ++i) { | 873 for (i = 0; i < 4; ++i) { |
635 const int x32_idx = ((i & 1) << 2); | 874 const int x32_idx = ((i & 1) << 2); |
636 const int y32_idx = ((i >> 1) << 2); | 875 const int y32_idx = ((i >> 1) << 2); |
| 876 const int i2 = i << 2; |
637 if (!set_vt_partitioning(cpi, xd, &vt.split[i], BLOCK_32X32, | 877 if (!set_vt_partitioning(cpi, xd, &vt.split[i], BLOCK_32X32, |
638 (mi_row + y32_idx), (mi_col + x32_idx))) { | 878 (mi_row + y32_idx), (mi_col + x32_idx), |
| 879 cpi->vbp_threshold, |
| 880 BLOCK_16X16, segment_id)) { |
639 for (j = 0; j < 4; ++j) { | 881 for (j = 0; j < 4; ++j) { |
640 const int x16_idx = ((j & 1) << 1); | 882 const int x16_idx = ((j & 1) << 1); |
641 const int y16_idx = ((j >> 1) << 1); | 883 const int y16_idx = ((j >> 1) << 1); |
642 // Note: If 8x8 downsampling is used for variance calculation we | 884 // For inter frames: if variance4x4downsample[] == 1 for this 16x16 |
643 // cannot really select block size 8x8 (or even 8x16/16x8), since we | 885 // block, then the variance is based on 4x4 down-sampling, so use vt2 |
644 // don't have sufficient samples for variance. So on delta frames, | 886 // in set_vt_partioning(), otherwise use vt. |
645 // 8x8 partition is only set if variance of the 16x16 block is very | 887 v16x16 *vtemp = (!is_key_frame && |
646 // high. For key frames, 4x4 downsampling is used, so we can better | 888 variance4x4downsample[i2 + j] == 1) ? |
647 // select 8x16/16x8 and 8x8. 4x4 partition can potentially be set | 889 &vt2[i2 + j] : &vt.split[i].split[j]; |
648 // used here too, but for now 4x4 is not allowed. | 890 if (!set_vt_partitioning(cpi, xd, vtemp, BLOCK_16X16, |
649 if (!set_vt_partitioning(cpi, xd, &vt.split[i].split[j], | |
650 BLOCK_16X16, | |
651 mi_row + y32_idx + y16_idx, | 891 mi_row + y32_idx + y16_idx, |
652 mi_col + x32_idx + x16_idx)) { | 892 mi_col + x32_idx + x16_idx, |
| 893 cpi->vbp_threshold_16x16, |
| 894 cpi->vbp_bsize_min, segment_id)) { |
653 for (k = 0; k < 4; ++k) { | 895 for (k = 0; k < 4; ++k) { |
654 const int x8_idx = (k & 1); | 896 const int x8_idx = (k & 1); |
655 const int y8_idx = (k >> 1); | 897 const int y8_idx = (k >> 1); |
656 if (cm->frame_type == KEY_FRAME) { | 898 if (use_4x4_partition) { |
657 if (!set_vt_partitioning(cpi, xd, | 899 if (!set_vt_partitioning(cpi, xd, &vtemp->split[k], |
658 &vt.split[i].split[j].split[k], | |
659 BLOCK_8X8, | 900 BLOCK_8X8, |
660 mi_row + y32_idx + y16_idx + y8_idx, | 901 mi_row + y32_idx + y16_idx + y8_idx, |
661 mi_col + x32_idx + x16_idx + x8_idx)) { | 902 mi_col + x32_idx + x16_idx + x8_idx, |
662 set_block_size(cpi, xd, | 903 cpi->vbp_threshold_bsize_min, |
663 (mi_row + y32_idx + y16_idx + y8_idx), | 904 BLOCK_8X8, segment_id)) { |
664 (mi_col + x32_idx + x16_idx + x8_idx), | 905 set_block_size(cpi, xd, |
665 BLOCK_4X4); | 906 (mi_row + y32_idx + y16_idx + y8_idx), |
| 907 (mi_col + x32_idx + x16_idx + x8_idx), |
| 908 BLOCK_4X4); |
666 } | 909 } |
667 } else { | 910 } else { |
668 set_block_size(cpi, xd, | 911 set_block_size(cpi, xd, |
669 (mi_row + y32_idx + y16_idx + y8_idx), | 912 (mi_row + y32_idx + y16_idx + y8_idx), |
670 (mi_col + x32_idx + x16_idx + x8_idx), | 913 (mi_col + x32_idx + x16_idx + x8_idx), |
671 BLOCK_8X8); | 914 BLOCK_8X8); |
672 } | 915 } |
673 } | 916 } |
674 } | 917 } |
675 } | 918 } |
676 } | 919 } |
677 } | 920 } |
678 } | 921 } |
679 } | 922 } |
680 | 923 |
681 static void update_state(VP9_COMP *cpi, ThreadData *td, | 924 static void update_state(VP9_COMP *cpi, ThreadData *td, |
682 PICK_MODE_CONTEXT *ctx, | 925 PICK_MODE_CONTEXT *ctx, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 // For in frame complexity AQ copy the segment id from the segment map. | 959 // For in frame complexity AQ copy the segment id from the segment map. |
717 if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) { | 960 if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) { |
718 const uint8_t *const map = seg->update_map ? cpi->segmentation_map | 961 const uint8_t *const map = seg->update_map ? cpi->segmentation_map |
719 : cm->last_frame_seg_map; | 962 : cm->last_frame_seg_map; |
720 mi_addr->mbmi.segment_id = | 963 mi_addr->mbmi.segment_id = |
721 vp9_get_segment_id(cm, map, bsize, mi_row, mi_col); | 964 vp9_get_segment_id(cm, map, bsize, mi_row, mi_col); |
722 } | 965 } |
723 // Else for cyclic refresh mode update the segment map, set the segment id | 966 // Else for cyclic refresh mode update the segment map, set the segment id |
724 // and then update the quantizer. | 967 // and then update the quantizer. |
725 if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) { | 968 if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) { |
726 vp9_cyclic_refresh_update_segment(cpi, &xd->mi[0].src_mi->mbmi, | 969 vp9_cyclic_refresh_update_segment(cpi, &xd->mi[0].src_mi->mbmi, mi_row, |
727 mi_row, mi_col, bsize, 1, ctx->rate); | 970 mi_col, bsize, ctx->rate, ctx->dist); |
728 } | 971 } |
729 } | 972 } |
730 | 973 |
731 max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1; | 974 max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1; |
732 for (i = 0; i < max_plane; ++i) { | 975 for (i = 0; i < max_plane; ++i) { |
733 p[i].coeff = ctx->coeff_pbuf[i][1]; | 976 p[i].coeff = ctx->coeff_pbuf[i][1]; |
734 p[i].qcoeff = ctx->qcoeff_pbuf[i][1]; | 977 p[i].qcoeff = ctx->qcoeff_pbuf[i][1]; |
735 pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1]; | 978 pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1]; |
736 p[i].eobs = ctx->eobs_pbuf[i][1]; | 979 p[i].eobs = ctx->eobs_pbuf[i][1]; |
737 } | 980 } |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 | 1647 |
1405 if (seg->enabled && cpi->oxcf.aq_mode) { | 1648 if (seg->enabled && cpi->oxcf.aq_mode) { |
1406 // For in frame complexity AQ or variance AQ, copy segment_id from | 1649 // For in frame complexity AQ or variance AQ, copy segment_id from |
1407 // segmentation_map. | 1650 // segmentation_map. |
1408 if (cpi->oxcf.aq_mode == COMPLEXITY_AQ || | 1651 if (cpi->oxcf.aq_mode == COMPLEXITY_AQ || |
1409 cpi->oxcf.aq_mode == VARIANCE_AQ ) { | 1652 cpi->oxcf.aq_mode == VARIANCE_AQ ) { |
1410 const uint8_t *const map = seg->update_map ? cpi->segmentation_map | 1653 const uint8_t *const map = seg->update_map ? cpi->segmentation_map |
1411 : cm->last_frame_seg_map; | 1654 : cm->last_frame_seg_map; |
1412 mbmi->segment_id = vp9_get_segment_id(cm, map, bsize, mi_row, mi_col); | 1655 mbmi->segment_id = vp9_get_segment_id(cm, map, bsize, mi_row, mi_col); |
1413 } else { | 1656 } else { |
1414 // Setting segmentation map for cyclic_refresh | 1657 // Setting segmentation map for cyclic_refresh. |
1415 vp9_cyclic_refresh_update_segment(cpi, mbmi, mi_row, mi_col, bsize, 1, | 1658 vp9_cyclic_refresh_update_segment(cpi, mbmi, mi_row, mi_col, bsize, |
1416 ctx->rate); | 1659 ctx->rate, ctx->dist); |
1417 } | 1660 } |
1418 vp9_init_plane_quantizers(cpi, x); | 1661 vp9_init_plane_quantizers(cpi, x); |
1419 } | 1662 } |
1420 | 1663 |
1421 if (is_inter_block(mbmi)) { | 1664 if (is_inter_block(mbmi)) { |
1422 vp9_update_mv_count(td); | 1665 vp9_update_mv_count(td); |
1423 if (cm->interp_filter == SWITCHABLE) { | 1666 if (cm->interp_filter == SWITCHABLE) { |
1424 const int pred_ctx = vp9_get_pred_context_switchable_interp(xd); | 1667 const int pred_ctx = vp9_get_pred_context_switchable_interp(xd); |
1425 ++td->counts->switchable_interp[pred_ctx][mbmi->interp_filter]; | 1668 ++td->counts->switchable_interp[pred_ctx][mbmi->interp_filter]; |
1426 } | 1669 } |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 return ALTREF_FRAME; | 2922 return ALTREF_FRAME; |
2680 else if (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame) | 2923 else if (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame) |
2681 return GOLDEN_FRAME; | 2924 return GOLDEN_FRAME; |
2682 else | 2925 else |
2683 return LAST_FRAME; | 2926 return LAST_FRAME; |
2684 } | 2927 } |
2685 | 2928 |
2686 static TX_MODE select_tx_mode(const VP9_COMP *cpi, MACROBLOCKD *const xd) { | 2929 static TX_MODE select_tx_mode(const VP9_COMP *cpi, MACROBLOCKD *const xd) { |
2687 if (xd->lossless) | 2930 if (xd->lossless) |
2688 return ONLY_4X4; | 2931 return ONLY_4X4; |
| 2932 if (cpi->common.frame_type == KEY_FRAME && |
| 2933 cpi->sf.use_nonrd_pick_mode && |
| 2934 cpi->sf.partition_search_type == VAR_BASED_PARTITION) |
| 2935 return ALLOW_16X16; |
2689 if (cpi->sf.tx_size_search_method == USE_LARGESTALL) | 2936 if (cpi->sf.tx_size_search_method == USE_LARGESTALL) |
2690 return ALLOW_32X32; | 2937 return ALLOW_32X32; |
2691 else if (cpi->sf.tx_size_search_method == USE_FULL_RD|| | 2938 else if (cpi->sf.tx_size_search_method == USE_FULL_RD|| |
2692 cpi->sf.tx_size_search_method == USE_TX_8X8) | 2939 cpi->sf.tx_size_search_method == USE_TX_8X8) |
2693 return TX_MODE_SELECT; | 2940 return TX_MODE_SELECT; |
2694 else | 2941 else |
2695 return cpi->common.tx_mode; | 2942 return cpi->common.tx_mode; |
2696 } | 2943 } |
2697 | 2944 |
2698 static void hybrid_intra_mode_search(VP9_COMP *cpi, MACROBLOCK *const x, | 2945 static void hybrid_intra_mode_search(VP9_COMP *cpi, MACROBLOCK *const x, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 | 2982 |
2736 if (rd_cost->rate == INT_MAX) | 2983 if (rd_cost->rate == INT_MAX) |
2737 vp9_rd_cost_reset(rd_cost); | 2984 vp9_rd_cost_reset(rd_cost); |
2738 | 2985 |
2739 ctx->rate = rd_cost->rate; | 2986 ctx->rate = rd_cost->rate; |
2740 ctx->dist = rd_cost->dist; | 2987 ctx->dist = rd_cost->dist; |
2741 } | 2988 } |
2742 | 2989 |
2743 static void fill_mode_info_sb(VP9_COMMON *cm, MACROBLOCK *x, | 2990 static void fill_mode_info_sb(VP9_COMMON *cm, MACROBLOCK *x, |
2744 int mi_row, int mi_col, | 2991 int mi_row, int mi_col, |
2745 BLOCK_SIZE bsize, BLOCK_SIZE subsize, | 2992 BLOCK_SIZE bsize, |
2746 PC_TREE *pc_tree) { | 2993 PC_TREE *pc_tree) { |
2747 MACROBLOCKD *xd = &x->e_mbd; | 2994 MACROBLOCKD *xd = &x->e_mbd; |
2748 int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4; | 2995 int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4; |
2749 PARTITION_TYPE partition = pc_tree->partitioning; | 2996 PARTITION_TYPE partition = pc_tree->partitioning; |
| 2997 BLOCK_SIZE subsize = get_subsize(bsize, partition); |
2750 | 2998 |
2751 assert(bsize >= BLOCK_8X8); | 2999 assert(bsize >= BLOCK_8X8); |
2752 | 3000 |
2753 if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) | 3001 if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) |
2754 return; | 3002 return; |
2755 | 3003 |
2756 switch (partition) { | 3004 switch (partition) { |
2757 case PARTITION_NONE: | 3005 case PARTITION_NONE: |
2758 set_mode_info_offsets(cm, xd, mi_row, mi_col); | 3006 set_mode_info_offsets(cm, xd, mi_row, mi_col); |
2759 *(xd->mi[0].src_mi) = pc_tree->none.mic; | 3007 *(xd->mi[0].src_mi) = pc_tree->none.mic; |
2760 duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize); | 3008 duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize); |
2761 break; | 3009 break; |
2762 case PARTITION_VERT: | 3010 case PARTITION_VERT: |
2763 set_mode_info_offsets(cm, xd, mi_row, mi_col); | 3011 set_mode_info_offsets(cm, xd, mi_row, mi_col); |
2764 *(xd->mi[0].src_mi) = pc_tree->vertical[0].mic; | 3012 *(xd->mi[0].src_mi) = pc_tree->vertical[0].mic; |
2765 duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize); | 3013 duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, subsize); |
2766 | 3014 |
2767 if (mi_col + hbs < cm->mi_cols) { | 3015 if (mi_col + hbs < cm->mi_cols) { |
2768 set_mode_info_offsets(cm, xd, mi_row, mi_col + hbs); | 3016 set_mode_info_offsets(cm, xd, mi_row, mi_col + hbs); |
2769 *(xd->mi[0].src_mi) = pc_tree->vertical[1].mic; | 3017 *(xd->mi[0].src_mi) = pc_tree->vertical[1].mic; |
2770 duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col + hbs, bsize); | 3018 duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col + hbs, subsize); |
2771 } | 3019 } |
2772 break; | 3020 break; |
2773 case PARTITION_HORZ: | 3021 case PARTITION_HORZ: |
2774 set_mode_info_offsets(cm, xd, mi_row, mi_col); | 3022 set_mode_info_offsets(cm, xd, mi_row, mi_col); |
2775 *(xd->mi[0].src_mi) = pc_tree->horizontal[0].mic; | 3023 *(xd->mi[0].src_mi) = pc_tree->horizontal[0].mic; |
2776 duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize); | 3024 duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, subsize); |
2777 if (mi_row + hbs < cm->mi_rows) { | 3025 if (mi_row + hbs < cm->mi_rows) { |
2778 set_mode_info_offsets(cm, xd, mi_row + hbs, mi_col); | 3026 set_mode_info_offsets(cm, xd, mi_row + hbs, mi_col); |
2779 *(xd->mi[0].src_mi) = pc_tree->horizontal[1].mic; | 3027 *(xd->mi[0].src_mi) = pc_tree->horizontal[1].mic; |
2780 duplicate_mode_info_in_sb(cm, xd, mi_row + hbs, mi_col, bsize); | 3028 duplicate_mode_info_in_sb(cm, xd, mi_row + hbs, mi_col, subsize); |
2781 } | 3029 } |
2782 break; | 3030 break; |
2783 case PARTITION_SPLIT: { | 3031 case PARTITION_SPLIT: { |
2784 BLOCK_SIZE subsubsize = get_subsize(subsize, PARTITION_SPLIT); | 3032 fill_mode_info_sb(cm, x, mi_row, mi_col, subsize, pc_tree->split[0]); |
2785 fill_mode_info_sb(cm, x, mi_row, mi_col, subsize, | |
2786 subsubsize, pc_tree->split[0]); | |
2787 fill_mode_info_sb(cm, x, mi_row, mi_col + hbs, subsize, | 3033 fill_mode_info_sb(cm, x, mi_row, mi_col + hbs, subsize, |
2788 subsubsize, pc_tree->split[1]); | 3034 pc_tree->split[1]); |
2789 fill_mode_info_sb(cm, x, mi_row + hbs, mi_col, subsize, | 3035 fill_mode_info_sb(cm, x, mi_row + hbs, mi_col, subsize, |
2790 subsubsize, pc_tree->split[2]); | 3036 pc_tree->split[2]); |
2791 fill_mode_info_sb(cm, x, mi_row + hbs, mi_col + hbs, subsize, | 3037 fill_mode_info_sb(cm, x, mi_row + hbs, mi_col + hbs, subsize, |
2792 subsubsize, pc_tree->split[3]); | 3038 pc_tree->split[3]); |
2793 break; | 3039 break; |
2794 } | 3040 } |
2795 default: | 3041 default: |
2796 break; | 3042 break; |
2797 } | 3043 } |
2798 } | 3044 } |
2799 | 3045 |
2800 // Reset the prediction pixel ready flag recursively. | 3046 // Reset the prediction pixel ready flag recursively. |
2801 static void pred_pixel_ready_reset(PC_TREE *pc_tree, BLOCK_SIZE bsize) { | 3047 static void pred_pixel_ready_reset(PC_TREE *pc_tree, BLOCK_SIZE bsize) { |
2802 pc_tree->none.pred_pixel_ready = 0; | 3048 pc_tree->none.pred_pixel_ready = 0; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 } | 3284 } |
3039 | 3285 |
3040 *rd_cost = best_rdc; | 3286 *rd_cost = best_rdc; |
3041 | 3287 |
3042 if (best_rdc.rate == INT_MAX) { | 3288 if (best_rdc.rate == INT_MAX) { |
3043 vp9_rd_cost_reset(rd_cost); | 3289 vp9_rd_cost_reset(rd_cost); |
3044 return; | 3290 return; |
3045 } | 3291 } |
3046 | 3292 |
3047 // update mode info array | 3293 // update mode info array |
3048 subsize = get_subsize(bsize, pc_tree->partitioning); | 3294 fill_mode_info_sb(cm, x, mi_row, mi_col, bsize, pc_tree); |
3049 fill_mode_info_sb(cm, x, mi_row, mi_col, bsize, subsize, | |
3050 pc_tree); | |
3051 | 3295 |
3052 if (best_rdc.rate < INT_MAX && best_rdc.dist < INT64_MAX && do_recon) { | 3296 if (best_rdc.rate < INT_MAX && best_rdc.dist < INT64_MAX && do_recon) { |
3053 int output_enabled = (bsize == BLOCK_64X64); | 3297 int output_enabled = (bsize == BLOCK_64X64); |
3054 encode_sb_rt(cpi, td, tile_info, tp, mi_row, mi_col, output_enabled, | 3298 encode_sb_rt(cpi, td, tile_info, tp, mi_row, mi_col, output_enabled, |
3055 bsize, pc_tree); | 3299 bsize, pc_tree); |
3056 } | 3300 } |
3057 | 3301 |
3058 if (bsize == BLOCK_64X64) { | 3302 if (bsize == BLOCK_64X64 && do_recon) { |
3059 assert(tp_orig < *tp); | 3303 assert(tp_orig < *tp); |
3060 assert(best_rdc.rate < INT_MAX); | 3304 assert(best_rdc.rate < INT_MAX); |
3061 assert(best_rdc.dist < INT64_MAX); | 3305 assert(best_rdc.dist < INT64_MAX); |
3062 } else { | 3306 } else { |
3063 assert(tp_orig == *tp); | 3307 assert(tp_orig == *tp); |
3064 } | 3308 } |
3065 } | 3309 } |
3066 | 3310 |
3067 static void nonrd_select_partition(VP9_COMP *cpi, | 3311 static void nonrd_select_partition(VP9_COMP *cpi, |
3068 ThreadData *td, | 3312 ThreadData *td, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 // Code each SB in the row | 3567 // Code each SB in the row |
3324 for (mi_col = tile_info->mi_col_start; mi_col < tile_info->mi_col_end; | 3568 for (mi_col = tile_info->mi_col_start; mi_col < tile_info->mi_col_end; |
3325 mi_col += MI_BLOCK_SIZE) { | 3569 mi_col += MI_BLOCK_SIZE) { |
3326 RD_COST dummy_rdc; | 3570 RD_COST dummy_rdc; |
3327 const int idx_str = cm->mi_stride * mi_row + mi_col; | 3571 const int idx_str = cm->mi_stride * mi_row + mi_col; |
3328 MODE_INFO *mi = cm->mi + idx_str; | 3572 MODE_INFO *mi = cm->mi + idx_str; |
3329 BLOCK_SIZE bsize; | 3573 BLOCK_SIZE bsize; |
3330 x->source_variance = UINT_MAX; | 3574 x->source_variance = UINT_MAX; |
3331 vp9_zero(x->pred_mv); | 3575 vp9_zero(x->pred_mv); |
3332 vp9_rd_cost_init(&dummy_rdc); | 3576 vp9_rd_cost_init(&dummy_rdc); |
| 3577 x->color_sensitivity[0] = 0; |
| 3578 x->color_sensitivity[1] = 0; |
3333 | 3579 |
3334 // Set the partition type of the 64X64 block | 3580 // Set the partition type of the 64X64 block |
3335 switch (sf->partition_search_type) { | 3581 switch (sf->partition_search_type) { |
3336 case VAR_BASED_PARTITION: | 3582 case VAR_BASED_PARTITION: |
3337 // TODO(jingning, marpan): The mode decision and encoding process | 3583 // TODO(jingning, marpan): The mode decision and encoding process |
3338 // support both intra and inter sub8x8 block coding for RTC mode. | 3584 // support both intra and inter sub8x8 block coding for RTC mode. |
3339 // Tune the thresholds accordingly to use sub8x8 block coding for | 3585 // Tune the thresholds accordingly to use sub8x8 block coding for |
3340 // coding performance improvement. | 3586 // coding performance improvement. |
3341 choose_partitioning(cpi, tile_info, x, mi_row, mi_col); | 3587 choose_partitioning(cpi, tile_info, x, mi_row, mi_col); |
3342 nonrd_use_partition(cpi, td, tile_data, mi, tp, mi_row, mi_col, | 3588 nonrd_use_partition(cpi, td, tile_data, mi, tp, mi_row, mi_col, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3612 vp9_zero(rdc->comp_pred_diff); | 3858 vp9_zero(rdc->comp_pred_diff); |
3613 vp9_zero(rdc->filter_diff); | 3859 vp9_zero(rdc->filter_diff); |
3614 vp9_zero(rdc->tx_select_diff); | 3860 vp9_zero(rdc->tx_select_diff); |
3615 vp9_zero(rd_opt->tx_select_threshes); | 3861 vp9_zero(rd_opt->tx_select_threshes); |
3616 | 3862 |
3617 xd->lossless = cm->base_qindex == 0 && | 3863 xd->lossless = cm->base_qindex == 0 && |
3618 cm->y_dc_delta_q == 0 && | 3864 cm->y_dc_delta_q == 0 && |
3619 cm->uv_dc_delta_q == 0 && | 3865 cm->uv_dc_delta_q == 0 && |
3620 cm->uv_ac_delta_q == 0; | 3866 cm->uv_ac_delta_q == 0; |
3621 | 3867 |
3622 cm->tx_mode = select_tx_mode(cpi, xd); | |
3623 if (cm->frame_type == KEY_FRAME && | |
3624 cpi->sf.use_nonrd_pick_mode && | |
3625 cpi->sf.partition_search_type == VAR_BASED_PARTITION) { | |
3626 cm->tx_mode = ALLOW_16X16; | |
3627 } | |
3628 | |
3629 | |
3630 #if CONFIG_VP9_HIGHBITDEPTH | 3868 #if CONFIG_VP9_HIGHBITDEPTH |
3631 if (cm->use_highbitdepth) | 3869 if (cm->use_highbitdepth) |
3632 x->fwd_txm4x4 = xd->lossless ? vp9_highbd_fwht4x4 : vp9_highbd_fdct4x4; | 3870 x->fwd_txm4x4 = xd->lossless ? vp9_highbd_fwht4x4 : vp9_highbd_fdct4x4; |
3633 else | 3871 else |
3634 x->fwd_txm4x4 = xd->lossless ? vp9_fwht4x4 : vp9_fdct4x4; | 3872 x->fwd_txm4x4 = xd->lossless ? vp9_fwht4x4 : vp9_fdct4x4; |
3635 x->highbd_itxm_add = xd->lossless ? vp9_highbd_iwht4x4_add : | 3873 x->highbd_itxm_add = xd->lossless ? vp9_highbd_iwht4x4_add : |
3636 vp9_highbd_idct4x4_add; | 3874 vp9_highbd_idct4x4_add; |
3637 #else | 3875 #else |
3638 x->fwd_txm4x4 = xd->lossless ? vp9_fwht4x4 : vp9_fdct4x4; | 3876 x->fwd_txm4x4 = xd->lossless ? vp9_fwht4x4 : vp9_fdct4x4; |
3639 #endif // CONFIG_VP9_HIGHBITDEPTH | 3877 #endif // CONFIG_VP9_HIGHBITDEPTH |
3640 x->itxm_add = xd->lossless ? vp9_iwht4x4_add : vp9_idct4x4_add; | 3878 x->itxm_add = xd->lossless ? vp9_iwht4x4_add : vp9_idct4x4_add; |
3641 | 3879 |
3642 if (xd->lossless) { | 3880 if (xd->lossless) |
3643 x->optimize = 0; | 3881 x->optimize = 0; |
3644 cm->lf.filter_level = 0; | 3882 |
3645 } | 3883 cm->tx_mode = select_tx_mode(cpi, xd); |
3646 | 3884 |
3647 vp9_frame_init_quantizer(cpi); | 3885 vp9_frame_init_quantizer(cpi); |
3648 | 3886 |
3649 vp9_initialize_rd_consts(cpi); | 3887 vp9_initialize_rd_consts(cpi); |
3650 vp9_initialize_me_consts(cpi, cm->base_qindex); | 3888 vp9_initialize_me_consts(cpi, cm->base_qindex); |
3651 init_encode_frame_mb_context(cpi); | 3889 init_encode_frame_mb_context(cpi); |
3652 cm->use_prev_frame_mvs = !cm->error_resilient_mode && | 3890 cm->use_prev_frame_mvs = !cm->error_resilient_mode && |
3653 cm->width == cm->last_width && | 3891 cm->width == cm->last_width && |
3654 cm->height == cm->last_height && | 3892 cm->height == cm->last_height && |
3655 !cm->intra_only && | 3893 !cm->intra_only && |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3723 return EIGHTTAP_SHARP; | 3961 return EIGHTTAP_SHARP; |
3724 } else if (threshes[EIGHTTAP] > threshes[SWITCHABLE - 1]) { | 3962 } else if (threshes[EIGHTTAP] > threshes[SWITCHABLE - 1]) { |
3725 return EIGHTTAP; | 3963 return EIGHTTAP; |
3726 } else { | 3964 } else { |
3727 return SWITCHABLE; | 3965 return SWITCHABLE; |
3728 } | 3966 } |
3729 } | 3967 } |
3730 | 3968 |
3731 void vp9_encode_frame(VP9_COMP *cpi) { | 3969 void vp9_encode_frame(VP9_COMP *cpi) { |
3732 VP9_COMMON *const cm = &cpi->common; | 3970 VP9_COMMON *const cm = &cpi->common; |
3733 RD_OPT *const rd_opt = &cpi->rd; | |
3734 FRAME_COUNTS *counts = cpi->td.counts; | |
3735 RD_COUNTS *const rdc = &cpi->td.rd_counts; | |
3736 | 3971 |
3737 // In the longer term the encoder should be generalized to match the | 3972 // In the longer term the encoder should be generalized to match the |
3738 // decoder such that we allow compound where one of the 3 buffers has a | 3973 // decoder such that we allow compound where one of the 3 buffers has a |
3739 // different sign bias and that buffer is then the fixed ref. However, this | 3974 // different sign bias and that buffer is then the fixed ref. However, this |
3740 // requires further work in the rd loop. For now the only supported encoder | 3975 // requires further work in the rd loop. For now the only supported encoder |
3741 // side behavior is where the ALT ref buffer has opposite sign bias to | 3976 // side behavior is where the ALT ref buffer has opposite sign bias to |
3742 // the other two. | 3977 // the other two. |
3743 if (!frame_is_intra_only(cm)) { | 3978 if (!frame_is_intra_only(cm)) { |
3744 if ((cm->ref_frame_sign_bias[ALTREF_FRAME] == | 3979 if ((cm->ref_frame_sign_bias[ALTREF_FRAME] == |
3745 cm->ref_frame_sign_bias[GOLDEN_FRAME]) || | 3980 cm->ref_frame_sign_bias[GOLDEN_FRAME]) || |
3746 (cm->ref_frame_sign_bias[ALTREF_FRAME] == | 3981 (cm->ref_frame_sign_bias[ALTREF_FRAME] == |
3747 cm->ref_frame_sign_bias[LAST_FRAME])) { | 3982 cm->ref_frame_sign_bias[LAST_FRAME])) { |
3748 cpi->allow_comp_inter_inter = 0; | 3983 cpi->allow_comp_inter_inter = 0; |
3749 } else { | 3984 } else { |
3750 cpi->allow_comp_inter_inter = 1; | 3985 cpi->allow_comp_inter_inter = 1; |
3751 cm->comp_fixed_ref = ALTREF_FRAME; | 3986 cm->comp_fixed_ref = ALTREF_FRAME; |
3752 cm->comp_var_ref[0] = LAST_FRAME; | 3987 cm->comp_var_ref[0] = LAST_FRAME; |
3753 cm->comp_var_ref[1] = GOLDEN_FRAME; | 3988 cm->comp_var_ref[1] = GOLDEN_FRAME; |
3754 } | 3989 } |
3755 } | 3990 } |
3756 | 3991 |
3757 if (cpi->sf.frame_parameter_update) { | 3992 if (cpi->sf.frame_parameter_update) { |
3758 int i; | 3993 int i; |
| 3994 RD_OPT *const rd_opt = &cpi->rd; |
| 3995 FRAME_COUNTS *counts = cpi->td.counts; |
| 3996 RD_COUNTS *const rdc = &cpi->td.rd_counts; |
3759 | 3997 |
3760 // This code does a single RD pass over the whole frame assuming | 3998 // This code does a single RD pass over the whole frame assuming |
3761 // either compound, single or hybrid prediction as per whatever has | 3999 // either compound, single or hybrid prediction as per whatever has |
3762 // worked best for that type of frame in the past. | 4000 // worked best for that type of frame in the past. |
3763 // It also predicts whether another coding mode would have worked | 4001 // It also predicts whether another coding mode would have worked |
3764 // better that this coding mode. If that is the case, it remembers | 4002 // better that this coding mode. If that is the case, it remembers |
3765 // that for subsequent frames. | 4003 // that for subsequent frames. |
3766 // It does the same analysis for transform size selection also. | 4004 // It does the same analysis for transform size selection also. |
3767 const MV_REFERENCE_FRAME frame_type = get_frame_type(cpi); | 4005 const MV_REFERENCE_FRAME frame_type = get_frame_type(cpi); |
3768 int64_t *const mode_thrs = rd_opt->prediction_type_threshes[frame_type]; | 4006 int64_t *const mode_thrs = rd_opt->prediction_type_threshes[frame_type]; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3833 count4x4 += counts->tx.p8x8[i][TX_4X4]; | 4071 count4x4 += counts->tx.p8x8[i][TX_4X4]; |
3834 | 4072 |
3835 count8x8_lp += counts->tx.p32x32[i][TX_8X8]; | 4073 count8x8_lp += counts->tx.p32x32[i][TX_8X8]; |
3836 count8x8_lp += counts->tx.p16x16[i][TX_8X8]; | 4074 count8x8_lp += counts->tx.p16x16[i][TX_8X8]; |
3837 count8x8_8x8p += counts->tx.p8x8[i][TX_8X8]; | 4075 count8x8_8x8p += counts->tx.p8x8[i][TX_8X8]; |
3838 | 4076 |
3839 count16x16_16x16p += counts->tx.p16x16[i][TX_16X16]; | 4077 count16x16_16x16p += counts->tx.p16x16[i][TX_16X16]; |
3840 count16x16_lp += counts->tx.p32x32[i][TX_16X16]; | 4078 count16x16_lp += counts->tx.p32x32[i][TX_16X16]; |
3841 count32x32 += counts->tx.p32x32[i][TX_32X32]; | 4079 count32x32 += counts->tx.p32x32[i][TX_32X32]; |
3842 } | 4080 } |
3843 | |
3844 if (count4x4 == 0 && count16x16_lp == 0 && count16x16_16x16p == 0 && | 4081 if (count4x4 == 0 && count16x16_lp == 0 && count16x16_16x16p == 0 && |
3845 count32x32 == 0) { | 4082 count32x32 == 0) { |
3846 cm->tx_mode = ALLOW_8X8; | 4083 cm->tx_mode = ALLOW_8X8; |
3847 reset_skip_tx_size(cm, TX_8X8); | 4084 reset_skip_tx_size(cm, TX_8X8); |
3848 } else if (count8x8_8x8p == 0 && count16x16_16x16p == 0 && | 4085 } else if (count8x8_8x8p == 0 && count16x16_16x16p == 0 && |
3849 count8x8_lp == 0 && count16x16_lp == 0 && count32x32 == 0) { | 4086 count8x8_lp == 0 && count16x16_lp == 0 && count32x32 == 0) { |
3850 cm->tx_mode = ONLY_4X4; | 4087 cm->tx_mode = ONLY_4X4; |
3851 reset_skip_tx_size(cm, TX_4X4); | 4088 reset_skip_tx_size(cm, TX_4X4); |
3852 } else if (count8x8_lp == 0 && count16x16_lp == 0 && count4x4 == 0) { | 4089 } else if (count8x8_lp == 0 && count16x16_lp == 0 && count4x4 == 0) { |
3853 cm->tx_mode = ALLOW_32X32; | 4090 cm->tx_mode = ALLOW_32X32; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3957 max_txsize_lookup[bsize]); | 4194 max_txsize_lookup[bsize]); |
3958 } else { | 4195 } else { |
3959 tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4; | 4196 tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4; |
3960 } | 4197 } |
3961 | 4198 |
3962 for (y = 0; y < mi_height; y++) | 4199 for (y = 0; y < mi_height; y++) |
3963 for (x = 0; x < mi_width; x++) | 4200 for (x = 0; x < mi_width; x++) |
3964 if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows) | 4201 if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows) |
3965 mi_8x8[mis * y + x].src_mi->mbmi.tx_size = tx_size; | 4202 mi_8x8[mis * y + x].src_mi->mbmi.tx_size = tx_size; |
3966 } | 4203 } |
| 4204 ++td->counts->tx.tx_totals[mbmi->tx_size]; |
| 4205 ++td->counts->tx.tx_totals[get_uv_tx_size(mbmi, &xd->plane[1])]; |
3967 } | 4206 } |
3968 } | 4207 } |
OLD | NEW |