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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 // Under aggressive denoising mode, should we use skin map to reduce denoi
ser | 855 // Under aggressive denoising mode, should we use skin map to reduce denoi
ser |
856 // and ZEROMV bias? Will need to revisit the accuracy of this detection fo
r | 856 // and ZEROMV bias? Will need to revisit the accuracy of this detection fo
r |
857 // very noisy input. For now keep this as is (i.e., don't turn it off). | 857 // very noisy input. For now keep this as is (i.e., don't turn it off). |
858 // if (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive) | 858 // if (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive) |
859 // x->is_skin = 0; | 859 // x->is_skin = 0; |
860 } | 860 } |
861 #endif | 861 #endif |
862 | 862 |
863 mode_mv = mode_mv_sb[sign_bias]; | 863 mode_mv = mode_mv_sb[sign_bias]; |
864 best_ref_mv.as_int = 0; | 864 best_ref_mv.as_int = 0; |
865 vpx_memset(mode_mv_sb, 0, sizeof(mode_mv_sb)); | 865 memset(mode_mv_sb, 0, sizeof(mode_mv_sb)); |
866 vpx_memset(&best_mbmode, 0, sizeof(best_mbmode)); | 866 memset(&best_mbmode, 0, sizeof(best_mbmode)); |
867 | 867 |
868 /* Setup search priorities */ | 868 /* Setup search priorities */ |
869 #if CONFIG_MULTI_RES_ENCODING | 869 #if CONFIG_MULTI_RES_ENCODING |
870 if (parent_ref_valid && parent_ref_frame && dissim < 8) | 870 if (parent_ref_valid && parent_ref_frame && dissim < 8) |
871 { | 871 { |
872 ref_frame_map[0] = -1; | 872 ref_frame_map[0] = -1; |
873 ref_frame_map[1] = parent_ref_frame; | 873 ref_frame_map[1] = parent_ref_frame; |
874 ref_frame_map[2] = -1; | 874 ref_frame_map[2] = -1; |
875 ref_frame_map[3] = -1; | 875 ref_frame_map[3] = -1; |
876 } else | 876 } else |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 | 1341 |
1342 if (this_rd < best_rd || x->skip) | 1342 if (this_rd < best_rd || x->skip) |
1343 { | 1343 { |
1344 /* Note index of best mode */ | 1344 /* Note index of best mode */ |
1345 best_mode_index = mode_index; | 1345 best_mode_index = mode_index; |
1346 | 1346 |
1347 *returnrate = rate2; | 1347 *returnrate = rate2; |
1348 *returndistortion = distortion2; | 1348 *returndistortion = distortion2; |
1349 best_rd_sse = sse; | 1349 best_rd_sse = sse; |
1350 best_rd = this_rd; | 1350 best_rd = this_rd; |
1351 vpx_memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi, | 1351 memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi, |
1352 sizeof(MB_MODE_INFO)); | 1352 sizeof(MB_MODE_INFO)); |
1353 | 1353 |
1354 /* Testing this mode gave rise to an improvement in best error | 1354 /* Testing this mode gave rise to an improvement in best error |
1355 * score. Lower threshold a bit for next time | 1355 * score. Lower threshold a bit for next time |
1356 */ | 1356 */ |
1357 x->rd_thresh_mult[mode_index] = | 1357 x->rd_thresh_mult[mode_index] = |
1358 (x->rd_thresh_mult[mode_index] >= (MIN_THRESHMULT + 2)) ? | 1358 (x->rd_thresh_mult[mode_index] >= (MIN_THRESHMULT + 2)) ? |
1359 x->rd_thresh_mult[mode_index] - 2 : MIN_THRESHMULT; | 1359 x->rd_thresh_mult[mode_index] - 2 : MIN_THRESHMULT; |
1360 x->rd_threshes[mode_index] = | 1360 x->rd_threshes[mode_index] = |
1361 (cpi->rd_baseline_thresh[mode_index] >> 7) * | 1361 (cpi->rd_baseline_thresh[mode_index] >> 7) * |
1362 x->rd_thresh_mult[mode_index]; | 1362 x->rd_thresh_mult[mode_index]; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 x->e_mbd.pre.v_buffer = plane[this_ref_frame][2]; | 1480 x->e_mbd.pre.v_buffer = plane[this_ref_frame][2]; |
1481 | 1481 |
1482 x->e_mbd.mode_info_context->mbmi.mode = ZEROMV; | 1482 x->e_mbd.mode_info_context->mbmi.mode = ZEROMV; |
1483 x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; | 1483 x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; |
1484 x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; | 1484 x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; |
1485 this_rd = evaluate_inter_mode(&sse, rate2, &distortion2, cpi, x, | 1485 this_rd = evaluate_inter_mode(&sse, rate2, &distortion2, cpi, x, |
1486 rd_adjustment); | 1486 rd_adjustment); |
1487 | 1487 |
1488 if (this_rd < best_rd) | 1488 if (this_rd < best_rd) |
1489 { | 1489 { |
1490 vpx_memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi, | 1490 memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi, |
1491 sizeof(MB_MODE_INFO)); | 1491 sizeof(MB_MODE_INFO)); |
1492 } | 1492 } |
1493 } | 1493 } |
1494 | 1494 |
1495 } | 1495 } |
1496 #endif | 1496 #endif |
1497 | 1497 |
1498 if (cpi->is_src_frame_alt_ref && | 1498 if (cpi->is_src_frame_alt_ref && |
1499 (best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME)) | 1499 (best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME)) |
1500 { | 1500 { |
1501 x->e_mbd.mode_info_context->mbmi.mode = ZEROMV; | 1501 x->e_mbd.mode_info_context->mbmi.mode = ZEROMV; |
1502 x->e_mbd.mode_info_context->mbmi.ref_frame = ALTREF_FRAME; | 1502 x->e_mbd.mode_info_context->mbmi.ref_frame = ALTREF_FRAME; |
1503 x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; | 1503 x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; |
1504 x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; | 1504 x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; |
1505 x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = | 1505 x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = |
1506 (cpi->common.mb_no_coeff_skip); | 1506 (cpi->common.mb_no_coeff_skip); |
1507 x->e_mbd.mode_info_context->mbmi.partitioning = 0; | 1507 x->e_mbd.mode_info_context->mbmi.partitioning = 0; |
1508 | 1508 |
1509 return; | 1509 return; |
1510 } | 1510 } |
1511 | 1511 |
1512 /* set to the best mb mode, this copy can be skip if x->skip since it | 1512 /* set to the best mb mode, this copy can be skip if x->skip since it |
1513 * already has the right content */ | 1513 * already has the right content */ |
1514 if (!x->skip) | 1514 if (!x->skip) |
1515 vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, | 1515 memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, |
1516 sizeof(MB_MODE_INFO)); | 1516 sizeof(MB_MODE_INFO)); |
1517 | 1517 |
1518 if (best_mbmode.mode <= B_PRED) | 1518 if (best_mbmode.mode <= B_PRED) |
1519 { | 1519 { |
1520 /* set mode_info_context->mbmi.uv_mode */ | 1520 /* set mode_info_context->mbmi.uv_mode */ |
1521 pick_intra_mbuv_mode(x); | 1521 pick_intra_mbuv_mode(x); |
1522 } | 1522 } |
1523 | 1523 |
1524 if (sign_bias | 1524 if (sign_bias |
1525 != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame]) | 1525 != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame]) |
1526 best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int; | 1526 best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 error4x4 = pick_intra4x4mby_modes(x, &rate, | 1569 error4x4 = pick_intra4x4mby_modes(x, &rate, |
1570 &best_sse); | 1570 &best_sse); |
1571 if (error4x4 < error16x16) | 1571 if (error4x4 < error16x16) |
1572 { | 1572 { |
1573 xd->mode_info_context->mbmi.mode = B_PRED; | 1573 xd->mode_info_context->mbmi.mode = B_PRED; |
1574 best_rate = rate; | 1574 best_rate = rate; |
1575 } | 1575 } |
1576 | 1576 |
1577 *rate_ = best_rate; | 1577 *rate_ = best_rate; |
1578 } | 1578 } |
OLD | NEW |