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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 cr->low_content_avg = fraction_low; | 350 cr->low_content_avg = fraction_low; |
351 } | 351 } |
352 } | 352 } |
353 | 353 |
354 // Update the segmentation map, and related quantities: cyclic refresh map, | 354 // Update the segmentation map, and related quantities: cyclic refresh map, |
355 // refresh sb_index, and target number of blocks to be refreshed. | 355 // refresh sb_index, and target number of blocks to be refreshed. |
356 // The map is set to either 0/CR_SEGMENT_ID_BASE (no refresh) or to | 356 // The map is set to either 0/CR_SEGMENT_ID_BASE (no refresh) or to |
357 // 1/CR_SEGMENT_ID_BOOST1 (refresh) for each superblock. | 357 // 1/CR_SEGMENT_ID_BOOST1 (refresh) for each superblock. |
358 // Blocks labeled as BOOST1 may later get set to BOOST2 (during the | 358 // Blocks labeled as BOOST1 may later get set to BOOST2 (during the |
359 // encoding of the superblock). | 359 // encoding of the superblock). |
360 void vp9_cyclic_refresh_update_map(VP9_COMP *const cpi) { | 360 static void cyclic_refresh_update_map(VP9_COMP *const cpi) { |
361 VP9_COMMON *const cm = &cpi->common; | 361 VP9_COMMON *const cm = &cpi->common; |
362 CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; | 362 CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; |
363 unsigned char *const seg_map = cpi->segmentation_map; | 363 unsigned char *const seg_map = cpi->segmentation_map; |
364 int i, block_count, bl_index, sb_rows, sb_cols, sbs_in_frame; | 364 int i, block_count, bl_index, sb_rows, sb_cols, sbs_in_frame; |
365 int xmis, ymis, x, y; | 365 int xmis, ymis, x, y; |
366 memset(seg_map, CR_SEGMENT_ID_BASE, cm->mi_rows * cm->mi_cols); | 366 memset(seg_map, CR_SEGMENT_ID_BASE, cm->mi_rows * cm->mi_cols); |
367 sb_cols = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; | 367 sb_cols = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; |
368 sb_rows = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; | 368 sb_rows = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; |
369 sbs_in_frame = sb_cols * sb_rows; | 369 sbs_in_frame = sb_cols * sb_rows; |
370 // Number of target blocks to get the q delta (segment 1). | 370 // Number of target blocks to get the q delta (segment 1). |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 vp9_set_segdata(seg, CR_SEGMENT_ID_BOOST1, SEG_LVL_ALT_Q, qindex_delta); | 503 vp9_set_segdata(seg, CR_SEGMENT_ID_BOOST1, SEG_LVL_ALT_Q, qindex_delta); |
504 | 504 |
505 // Set a more aggressive (higher) q delta for segment BOOST2. | 505 // Set a more aggressive (higher) q delta for segment BOOST2. |
506 qindex_delta = compute_deltaq(cpi, cm->base_qindex, | 506 qindex_delta = compute_deltaq(cpi, cm->base_qindex, |
507 MIN(CR_MAX_RATE_TARGET_RATIO, | 507 MIN(CR_MAX_RATE_TARGET_RATIO, |
508 CR_BOOST2_FAC * cr->rate_ratio_qdelta)); | 508 CR_BOOST2_FAC * cr->rate_ratio_qdelta)); |
509 cr->qindex_delta_seg2 = qindex_delta; | 509 cr->qindex_delta_seg2 = qindex_delta; |
510 vp9_set_segdata(seg, CR_SEGMENT_ID_BOOST2, SEG_LVL_ALT_Q, qindex_delta); | 510 vp9_set_segdata(seg, CR_SEGMENT_ID_BOOST2, SEG_LVL_ALT_Q, qindex_delta); |
511 | 511 |
512 // Update the segmentation and refresh map. | 512 // Update the segmentation and refresh map. |
513 vp9_cyclic_refresh_update_map(cpi); | 513 cyclic_refresh_update_map(cpi); |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 int vp9_cyclic_refresh_get_rdmult(const CYCLIC_REFRESH *cr) { | 517 int vp9_cyclic_refresh_get_rdmult(const CYCLIC_REFRESH *cr) { |
518 return cr->rdmult; | 518 return cr->rdmult; |
519 } | 519 } |
OLD | NEW |