| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // TODO(yunqingwang): In this function, only y-plane dist is | 336 // TODO(yunqingwang): In this function, only y-plane dist is |
| 337 // calculated. | 337 // calculated. |
| 338 *dist = (sse << 4); // + ((sse_u + sse_v) << 4); | 338 *dist = (sse << 4); // + ((sse_u + sse_v) << 4); |
| 339 | 339 |
| 340 // *disable_skip = 1; | 340 // *disable_skip = 1; |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 static const THR_MODES mode_idx[MAX_REF_FRAMES - 1][4] = { |
| 347 {THR_NEARESTMV, THR_NEARMV, THR_ZEROMV, THR_NEWMV}, |
| 348 {THR_NEARESTG, THR_NEARG, THR_ZEROG, THR_NEWG}, |
| 349 {THR_NEARESTA, THR_NEARA, THR_ZEROA, THR_NEWA}, |
| 350 }; |
| 351 |
| 346 // TODO(jingning) placeholder for inter-frame non-RD mode decision. | 352 // TODO(jingning) placeholder for inter-frame non-RD mode decision. |
| 347 // this needs various further optimizations. to be continued.. | 353 // this needs various further optimizations. to be continued.. |
| 348 int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, | 354 int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, |
| 349 const TileInfo *const tile, | 355 const TileInfo *const tile, |
| 350 int mi_row, int mi_col, | 356 int mi_row, int mi_col, |
| 351 int *returnrate, | 357 int *returnrate, |
| 352 int64_t *returndistortion, | 358 int64_t *returndistortion, |
| 353 BLOCK_SIZE bsize) { | 359 BLOCK_SIZE bsize, |
| 360 PICK_MODE_CONTEXT *ctx) { |
| 354 MACROBLOCKD *xd = &x->e_mbd; | 361 MACROBLOCKD *xd = &x->e_mbd; |
| 355 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; | 362 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; |
| 356 struct macroblock_plane *const p = &x->plane[0]; | 363 struct macroblock_plane *const p = &x->plane[0]; |
| 357 struct macroblockd_plane *const pd = &xd->plane[0]; | 364 struct macroblockd_plane *const pd = &xd->plane[0]; |
| 358 PREDICTION_MODE this_mode, best_mode = ZEROMV; | 365 PREDICTION_MODE this_mode, best_mode = ZEROMV; |
| 359 MV_REFERENCE_FRAME ref_frame, best_ref_frame = LAST_FRAME; | 366 MV_REFERENCE_FRAME ref_frame, best_ref_frame = LAST_FRAME; |
| 360 TX_SIZE best_tx_size = MIN(max_txsize_lookup[bsize], | 367 TX_SIZE best_tx_size = MIN(max_txsize_lookup[bsize], |
| 361 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); | 368 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); |
| 362 INTERP_FILTER best_pred_filter = EIGHTTAP; | 369 INTERP_FILTER best_pred_filter = EIGHTTAP; |
| 363 int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; | 370 int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; |
| 364 struct buf_2d yv12_mb[4][MAX_MB_PLANE]; | 371 struct buf_2d yv12_mb[4][MAX_MB_PLANE]; |
| 365 static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, | 372 static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, |
| 366 VP9_ALT_FLAG }; | 373 VP9_ALT_FLAG }; |
| 367 int64_t best_rd = INT64_MAX; | 374 int64_t best_rd = INT64_MAX; |
| 368 int64_t this_rd = INT64_MAX; | 375 int64_t this_rd = INT64_MAX; |
| 369 int skip_txfm = 0; | 376 int skip_txfm = 0; |
| 370 | |
| 371 int rate = INT_MAX; | 377 int rate = INT_MAX; |
| 372 int64_t dist = INT64_MAX; | 378 int64_t dist = INT64_MAX; |
| 373 // var_y and sse_y are saved to be used in skipping checking | 379 // var_y and sse_y are saved to be used in skipping checking |
| 374 unsigned int var_y = UINT_MAX; | 380 unsigned int var_y = UINT_MAX; |
| 375 unsigned int sse_y = UINT_MAX; | 381 unsigned int sse_y = UINT_MAX; |
| 376 | 382 |
| 377 VP9_COMMON *cm = &cpi->common; | 383 VP9_COMMON *cm = &cpi->common; |
| 378 int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); | 384 int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); |
| 379 | 385 |
| 380 const int64_t inter_mode_thresh = RDCOST(x->rdmult, x->rddiv, | 386 const int64_t inter_mode_thresh = RDCOST(x->rdmult, x->rddiv, |
| 381 intra_cost_penalty, 0); | 387 intra_cost_penalty, 0); |
| 382 const int64_t intra_mode_cost = 50; | 388 const int64_t intra_mode_cost = 50; |
| 383 | 389 |
| 384 unsigned char segment_id = mbmi->segment_id; | 390 unsigned char segment_id = mbmi->segment_id; |
| 385 const int *const rd_threshes = cpi->rd.threshes[segment_id][bsize]; | 391 const int *const rd_threshes = cpi->rd.threshes[segment_id][bsize]; |
| 386 const int *const rd_thresh_freq_fact = cpi->rd.thresh_freq_fact[bsize]; | 392 const int *const rd_thresh_freq_fact = cpi->rd.thresh_freq_fact[bsize]; |
| 387 // Mode index conversion form THR_MODES to PREDICTION_MODE for a ref frame. | 393 // Mode index conversion form THR_MODES to PREDICTION_MODE for a ref frame. |
| 388 int mode_idx[MB_MODE_COUNT] = {0}; | |
| 389 INTERP_FILTER filter_ref = cm->interp_filter; | 394 INTERP_FILTER filter_ref = cm->interp_filter; |
| 390 int bsl = mi_width_log2(bsize); | 395 int bsl = mi_width_log2(bsize); |
| 391 const int pred_filter_search = cm->interp_filter == SWITCHABLE ? | 396 const int pred_filter_search = cm->interp_filter == SWITCHABLE ? |
| 392 (((mi_row + mi_col) >> bsl) + get_chessboard_index(cm)) % 2 : 0; | 397 (((mi_row + mi_col) >> bsl) + get_chessboard_index(cm)) % 2 : 0; |
| 393 int const_motion[MAX_REF_FRAMES] = { 0 }; | 398 int const_motion[MAX_REF_FRAMES] = { 0 }; |
| 394 | |
| 395 // For speed 6, the result of interp filter is reused later in actual encoding | |
| 396 // process. | |
| 397 int bh = num_4x4_blocks_high_lookup[bsize] << 2; | 399 int bh = num_4x4_blocks_high_lookup[bsize] << 2; |
| 398 int bw = num_4x4_blocks_wide_lookup[bsize] << 2; | 400 int bw = num_4x4_blocks_wide_lookup[bsize] << 2; |
| 399 int pixels_in_block = bh * bw; | 401 int pixels_in_block = bh * bw; |
| 402 // For speed 6, the result of interp filter is reused later in actual encoding |
| 403 // process. |
| 400 // tmp[3] points to dst buffer, and the other 3 point to allocated buffers. | 404 // tmp[3] points to dst buffer, and the other 3 point to allocated buffers. |
| 401 PRED_BUFFER tmp[4]; | 405 PRED_BUFFER tmp[4]; |
| 402 DECLARE_ALIGNED_ARRAY(16, uint8_t, pred_buf, 3 * 64 * 64); | 406 DECLARE_ALIGNED_ARRAY(16, uint8_t, pred_buf, 3 * 64 * 64); |
| 403 struct buf_2d orig_dst = pd->dst; | 407 struct buf_2d orig_dst = pd->dst; |
| 404 PRED_BUFFER *best_pred = NULL; | 408 PRED_BUFFER *best_pred = NULL; |
| 405 PRED_BUFFER *this_mode_pred = NULL; | 409 PRED_BUFFER *this_mode_pred = NULL; |
| 406 int i; | 410 int i; |
| 407 | 411 |
| 408 #if CONFIG_DENOISING | |
| 409 if (cpi->oxcf.noise_sensitivity > 0) { | |
| 410 vp9_denoiser_reset_frame_stats(&cpi->denoiser); | |
| 411 } | |
| 412 #endif | |
| 413 | |
| 414 if (cpi->sf.reuse_inter_pred_sby) { | 412 if (cpi->sf.reuse_inter_pred_sby) { |
| 415 for (i = 0; i < 3; i++) { | 413 for (i = 0; i < 3; i++) { |
| 416 tmp[i].data = &pred_buf[pixels_in_block * i]; | 414 tmp[i].data = &pred_buf[pixels_in_block * i]; |
| 417 tmp[i].stride = bw; | 415 tmp[i].stride = bw; |
| 418 tmp[i].in_use = 0; | 416 tmp[i].in_use = 0; |
| 419 } | 417 } |
| 420 | |
| 421 tmp[3].data = pd->dst.buf; | 418 tmp[3].data = pd->dst.buf; |
| 422 tmp[3].stride = pd->dst.stride; | 419 tmp[3].stride = pd->dst.stride; |
| 423 tmp[3].in_use = 0; | 420 tmp[3].in_use = 0; |
| 424 } | 421 } |
| 425 | 422 |
| 426 x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; | 423 x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; |
| 427 | |
| 428 x->skip = 0; | 424 x->skip = 0; |
| 429 | 425 |
| 430 // initialize mode decisions | 426 // initialize mode decisions |
| 431 *returnrate = INT_MAX; | 427 *returnrate = INT_MAX; |
| 432 *returndistortion = INT64_MAX; | 428 *returndistortion = INT64_MAX; |
| 433 vpx_memset(mbmi, 0, sizeof(MB_MODE_INFO)); | 429 vpx_memset(mbmi, 0, sizeof(MB_MODE_INFO)); |
| 434 mbmi->sb_type = bsize; | 430 mbmi->sb_type = bsize; |
| 435 mbmi->ref_frame[0] = NONE; | 431 mbmi->ref_frame[0] = NONE; |
| 436 mbmi->ref_frame[1] = NONE; | 432 mbmi->ref_frame[1] = NONE; |
| 437 mbmi->tx_size = MIN(max_txsize_lookup[bsize], | 433 mbmi->tx_size = MIN(max_txsize_lookup[bsize], |
| 438 tx_mode_to_biggest_tx_size[cm->tx_mode]); | 434 tx_mode_to_biggest_tx_size[cm->tx_mode]); |
| 439 mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? | 435 mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? |
| 440 EIGHTTAP : cm->interp_filter; | 436 EIGHTTAP : cm->interp_filter; |
| 441 mbmi->skip = 0; | |
| 442 mbmi->segment_id = segment_id; | 437 mbmi->segment_id = segment_id; |
| 443 | 438 |
| 444 for (ref_frame = LAST_FRAME; ref_frame <= LAST_FRAME ; ++ref_frame) { | 439 for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { |
| 445 x->pred_mv_sad[ref_frame] = INT_MAX; | 440 x->pred_mv_sad[ref_frame] = INT_MAX; |
| 441 frame_mv[NEWMV][ref_frame].as_int = INVALID_MV; |
| 442 frame_mv[ZEROMV][ref_frame].as_int = 0; |
| 443 |
| 444 if (xd->up_available) |
| 445 filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter; |
| 446 else if (xd->left_available) |
| 447 filter_ref = xd->mi[-1]->mbmi.interp_filter; |
| 448 |
| 446 if (cpi->ref_frame_flags & flag_list[ref_frame]) { | 449 if (cpi->ref_frame_flags & flag_list[ref_frame]) { |
| 447 const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, ref_frame); | 450 const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, ref_frame); |
| 448 int_mv *const candidates = mbmi->ref_mvs[ref_frame]; | 451 int_mv *const candidates = mbmi->ref_mvs[ref_frame]; |
| 449 const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf; | 452 const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf; |
| 450 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, | 453 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, |
| 451 sf, sf); | 454 sf, sf); |
| 452 | 455 |
| 453 if (cm->coding_use_prev_mi) | 456 if (cm->coding_use_prev_mi) |
| 454 vp9_find_mv_refs(cm, xd, tile, xd->mi[0], ref_frame, | 457 vp9_find_mv_refs(cm, xd, tile, xd->mi[0], ref_frame, |
| 455 candidates, mi_row, mi_col); | 458 candidates, mi_row, mi_col); |
| 456 else | 459 else |
| 457 const_motion[ref_frame] = mv_refs_rt(cm, xd, tile, xd->mi[0], | 460 const_motion[ref_frame] = mv_refs_rt(cm, xd, tile, xd->mi[0], |
| 458 ref_frame, candidates, | 461 ref_frame, candidates, |
| 459 mi_row, mi_col); | 462 mi_row, mi_col); |
| 460 | 463 |
| 461 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates, | 464 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates, |
| 462 &frame_mv[NEARESTMV][ref_frame], | 465 &frame_mv[NEARESTMV][ref_frame], |
| 463 &frame_mv[NEARMV][ref_frame]); | 466 &frame_mv[NEARMV][ref_frame]); |
| 464 | 467 |
| 465 if (!vp9_is_scaled(sf) && bsize >= BLOCK_8X8) | 468 if (!vp9_is_scaled(sf) && bsize >= BLOCK_8X8) |
| 466 vp9_mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12->y_stride, | 469 vp9_mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12->y_stride, |
| 467 ref_frame, bsize); | 470 ref_frame, bsize); |
| 471 } else { |
| 472 continue; |
| 468 } | 473 } |
| 469 frame_mv[NEWMV][ref_frame].as_int = INVALID_MV; | |
| 470 frame_mv[ZEROMV][ref_frame].as_int = 0; | |
| 471 } | |
| 472 | |
| 473 if (xd->up_available) | |
| 474 filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter; | |
| 475 else if (xd->left_available) | |
| 476 filter_ref = xd->mi[-1]->mbmi.interp_filter; | |
| 477 | |
| 478 for (ref_frame = LAST_FRAME; ref_frame <= LAST_FRAME ; ++ref_frame) { | |
| 479 if (!(cpi->ref_frame_flags & flag_list[ref_frame])) | |
| 480 continue; | |
| 481 | 474 |
| 482 // Select prediction reference frames. | 475 // Select prediction reference frames. |
| 483 xd->plane[0].pre[0] = yv12_mb[ref_frame][0]; | 476 xd->plane[0].pre[0] = yv12_mb[ref_frame][0]; |
| 484 | 477 |
| 485 clamp_mv2(&frame_mv[NEARESTMV][ref_frame].as_mv, xd); | 478 clamp_mv2(&frame_mv[NEARESTMV][ref_frame].as_mv, xd); |
| 486 clamp_mv2(&frame_mv[NEARMV][ref_frame].as_mv, xd); | 479 clamp_mv2(&frame_mv[NEARMV][ref_frame].as_mv, xd); |
| 487 | 480 |
| 488 mbmi->ref_frame[0] = ref_frame; | 481 mbmi->ref_frame[0] = ref_frame; |
| 489 | 482 |
| 490 // Set conversion index for LAST_FRAME. | |
| 491 if (ref_frame == LAST_FRAME) { | |
| 492 mode_idx[NEARESTMV] = THR_NEARESTMV; // LAST_FRAME, NEARESTMV | |
| 493 mode_idx[NEARMV] = THR_NEARMV; // LAST_FRAME, NEARMV | |
| 494 mode_idx[ZEROMV] = THR_ZEROMV; // LAST_FRAME, ZEROMV | |
| 495 mode_idx[NEWMV] = THR_NEWMV; // LAST_FRAME, NEWMV | |
| 496 } | |
| 497 | |
| 498 for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) { | 483 for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) { |
| 499 int rate_mv = 0; | 484 int rate_mv = 0; |
| 485 int mode_rd_thresh; |
| 500 | 486 |
| 501 if (const_motion[ref_frame] && | 487 if (const_motion[ref_frame] && |
| 502 (this_mode == NEARMV || this_mode == ZEROMV)) | 488 (this_mode == NEARMV || this_mode == ZEROMV)) |
| 503 continue; | 489 continue; |
| 504 | 490 |
| 505 if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode))) | 491 if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode))) |
| 506 continue; | 492 continue; |
| 507 | 493 |
| 508 if (rd_less_than_thresh(best_rd, rd_threshes[mode_idx[this_mode]], | 494 mode_rd_thresh = rd_threshes[mode_idx[ref_frame - LAST_FRAME] |
| 495 [this_mode - NEARESTMV]]; |
| 496 if (rd_less_than_thresh(best_rd, mode_rd_thresh, |
| 509 rd_thresh_freq_fact[this_mode])) | 497 rd_thresh_freq_fact[this_mode])) |
| 510 continue; | 498 continue; |
| 511 | 499 |
| 512 if (this_mode == NEWMV) { | 500 if (this_mode == NEWMV) { |
| 513 if (this_rd < (int64_t)(1 << num_pels_log2_lookup[bsize])) | 501 if (this_rd < (int64_t)(1 << num_pels_log2_lookup[bsize])) |
| 514 continue; | 502 continue; |
| 515 if (!combined_motion_search(cpi, x, bsize, mi_row, mi_col, | 503 if (!combined_motion_search(cpi, x, bsize, mi_row, mi_col, |
| 516 &frame_mv[NEWMV][ref_frame], | 504 &frame_mv[NEWMV][ref_frame], |
| 517 &rate_mv, best_rd)) | 505 &rate_mv, best_rd)) |
| 518 continue; | 506 continue; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 encode_breakout_test(cpi, x, bsize, mi_row, mi_col, ref_frame, | 597 encode_breakout_test(cpi, x, bsize, mi_row, mi_col, ref_frame, |
| 610 this_mode, var_y, sse_y, yv12_mb, &rate, &dist); | 598 this_mode, var_y, sse_y, yv12_mb, &rate, &dist); |
| 611 if (x->skip) { | 599 if (x->skip) { |
| 612 rate += rate_mv; | 600 rate += rate_mv; |
| 613 this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist); | 601 this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist); |
| 614 } | 602 } |
| 615 } | 603 } |
| 616 | 604 |
| 617 #if CONFIG_DENOISING | 605 #if CONFIG_DENOISING |
| 618 if (cpi->oxcf.noise_sensitivity > 0) { | 606 if (cpi->oxcf.noise_sensitivity > 0) { |
| 619 vp9_denoiser_update_frame_stats(&cpi->denoiser, mbmi, sse_y, this_mode); | 607 vp9_denoiser_update_frame_stats(&cpi->denoiser, mbmi, sse_y, |
| 608 this_mode, ctx); |
| 620 } | 609 } |
| 621 #endif | 610 #endif |
| 622 | 611 |
| 623 if (this_rd < best_rd || x->skip) { | 612 if (this_rd < best_rd || x->skip) { |
| 624 best_rd = this_rd; | 613 best_rd = this_rd; |
| 625 *returnrate = rate; | 614 *returnrate = rate; |
| 626 *returndistortion = dist; | 615 *returndistortion = dist; |
| 627 best_mode = this_mode; | 616 best_mode = this_mode; |
| 628 best_pred_filter = mbmi->interp_filter; | 617 best_pred_filter = mbmi->interp_filter; |
| 629 best_tx_size = mbmi->tx_size; | 618 best_tx_size = mbmi->tx_size; |
| 630 best_ref_frame = ref_frame; | 619 best_ref_frame = ref_frame; |
| 631 skip_txfm = x->skip_txfm; | 620 skip_txfm = x->skip_txfm; |
| 632 | 621 |
| 633 if (cpi->sf.reuse_inter_pred_sby) { | 622 if (cpi->sf.reuse_inter_pred_sby) { |
| 634 if (best_pred != NULL) | 623 if (best_pred != NULL) |
| 635 free_pred_buffer(best_pred); | 624 free_pred_buffer(best_pred); |
| 636 | 625 |
| 637 best_pred = this_mode_pred; | 626 best_pred = this_mode_pred; |
| 638 } | 627 } |
| 639 } else { | 628 } else { |
| 640 if (cpi->sf.reuse_inter_pred_sby) | 629 if (cpi->sf.reuse_inter_pred_sby) |
| 641 free_pred_buffer(this_mode_pred); | 630 free_pred_buffer(this_mode_pred); |
| 642 } | 631 } |
| 643 | 632 |
| 644 if (x->skip) | 633 if (x->skip) |
| 645 break; | 634 break; |
| 646 } | 635 } |
| 636 // If the current reference frame is valid and we found a usable mode, |
| 637 // we are done. |
| 638 if (best_rd < INT64_MAX) |
| 639 break; |
| 647 } | 640 } |
| 648 | 641 |
| 649 // If best prediction is not in dst buf, then copy the prediction block from | 642 // If best prediction is not in dst buf, then copy the prediction block from |
| 650 // temp buf to dst buf. | 643 // temp buf to dst buf. |
| 651 if (cpi->sf.reuse_inter_pred_sby && best_pred->data != orig_dst.buf) { | 644 if (cpi->sf.reuse_inter_pred_sby && best_pred->data != orig_dst.buf) { |
| 652 uint8_t *copy_from, *copy_to; | 645 uint8_t *copy_from, *copy_to; |
| 653 | 646 |
| 654 pd->dst = orig_dst; | 647 pd->dst = orig_dst; |
| 655 copy_to = pd->dst.buf; | 648 copy_to = pd->dst.buf; |
| 656 | 649 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 672 // threshold. | 665 // threshold. |
| 673 if (!x->skip && best_rd > inter_mode_thresh && | 666 if (!x->skip && best_rd > inter_mode_thresh && |
| 674 bsize <= cpi->sf.max_intra_bsize) { | 667 bsize <= cpi->sf.max_intra_bsize) { |
| 675 int i, j; | 668 int i, j; |
| 676 const int width = num_4x4_blocks_wide_lookup[bsize]; | 669 const int width = num_4x4_blocks_wide_lookup[bsize]; |
| 677 const int height = num_4x4_blocks_high_lookup[bsize]; | 670 const int height = num_4x4_blocks_high_lookup[bsize]; |
| 678 const BLOCK_SIZE bsize_tx = txsize_to_bsize[mbmi->tx_size]; | 671 const BLOCK_SIZE bsize_tx = txsize_to_bsize[mbmi->tx_size]; |
| 679 | 672 |
| 680 int rate2 = 0; | 673 int rate2 = 0; |
| 681 int64_t dist2 = 0; | 674 int64_t dist2 = 0; |
| 682 const int dst_stride = pd->dst.stride; | 675 const int dst_stride = cpi->sf.reuse_inter_pred_sby ? bw : pd->dst.stride; |
| 683 const int src_stride = p->src.stride; | 676 const int src_stride = p->src.stride; |
| 684 int block_idx = 0; | 677 int block_idx = 0; |
| 685 | 678 |
| 686 TX_SIZE tmp_tx_size = MIN(max_txsize_lookup[bsize], | 679 TX_SIZE tmp_tx_size = MIN(max_txsize_lookup[bsize], |
| 687 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); | 680 tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); |
| 688 const int step = 1 << tmp_tx_size; | 681 const int step = 1 << tmp_tx_size; |
| 689 | 682 |
| 690 for (this_mode = DC_PRED; this_mode <= DC_PRED; ++this_mode) { | 683 for (this_mode = DC_PRED; this_mode <= DC_PRED; ++this_mode) { |
| 691 if (cpi->sf.reuse_inter_pred_sby) { | 684 if (cpi->sf.reuse_inter_pred_sby) { |
| 692 pd->dst.buf = tmp[0].data; | 685 pd->dst.buf = tmp[0].data; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 mbmi->tx_size = tmp_tx_size; | 719 mbmi->tx_size = tmp_tx_size; |
| 727 mbmi->ref_frame[0] = INTRA_FRAME; | 720 mbmi->ref_frame[0] = INTRA_FRAME; |
| 728 mbmi->uv_mode = this_mode; | 721 mbmi->uv_mode = this_mode; |
| 729 mbmi->mv[0].as_int = INVALID_MV; | 722 mbmi->mv[0].as_int = INVALID_MV; |
| 730 } else { | 723 } else { |
| 731 x->skip_txfm = skip_txfm; | 724 x->skip_txfm = skip_txfm; |
| 732 } | 725 } |
| 733 } | 726 } |
| 734 } | 727 } |
| 735 | 728 |
| 736 #if CONFIG_DENOISING | |
| 737 if (cpi->oxcf.noise_sensitivity > 0) { | |
| 738 vp9_denoiser_denoise(&cpi->denoiser, x, mi_row, mi_col, bsize); | |
| 739 } | |
| 740 #endif | |
| 741 | |
| 742 return INT64_MAX; | 729 return INT64_MAX; |
| 743 } | 730 } |
| OLD | NEW |