| @@ -48,6 +48,7 @@ CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols) { · 47 unmodified lines |
| 48 | 48 | assert(MAXQ <= 255); |
| 49 | 49 | memset(cr->last_coded_q_map, MAXQ, last_coded_q_map_size); |
| 50 | 50 | cr->counter_encode_maxq_scene_change = 0; |
| 51 | + cr->content_mode = 1; |
| 51 | 52 | return cr; |
| 52 | 53 | } |
| 53 | 54 | |
| @@ -326,7 +327,8 @@ void vp9_cyclic_refresh_set_golden_update(VP9_COMP *const cpi) { · 272 unmodified lines |
| 326 | 327 | else |
| 327 | 328 | rc->baseline_gf_interval = 40; |
| 328 | 329 | if (cpi->oxcf.rc_mode == VPX_VBR) rc->baseline_gf_interval = 20; |
| 329 | | − if (rc->avg_frame_low_motion < 50 && rc->frames_since_key > 40) |
| 330 | + if (rc->avg_frame_low_motion < 50 && rc->frames_since_key > 40 && |
| 331 | + cr->content_mode) |
| 330 | 332 | rc->baseline_gf_interval = 10; |
| 331 | 333 | } |
| 332 | 334 | |
| @@ -388,7 +390,8 @@ static void cyclic_refresh_update_map(VP9_COMP *const cpi) { · 55 unmodified lines |
| 388 | 390 | ? vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST2, cm->base_qindex) |
| 389 | 391 | : vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST1, cm->base_qindex); |
| 390 | 392 | // More aggressive settings for noisy content. |
| 391 | | − if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium) { |
| 393 | + if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium && |
| 394 | + cr->content_mode) { |
| 392 | 395 | consec_zero_mv_thresh = 60; |
| 393 | 396 | qindex_thresh = |
| 394 | 397 | VPXMAX(vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST1, cm->base_qindex), |
| @@ -409,7 +412,7 @@ static void cyclic_refresh_update_map(VP9_COMP *const cpi) { · 14 unmodified lines |
| 409 | 412 | #if CONFIG_VP9_HIGHBITDEPTH |
| 410 | 413 | if (cpi->common.use_highbitdepth) compute_content = 0; |
| 411 | 414 | #endif |
| 412 | | − if (cpi->Last_Source == NULL || |
| 415 | + if (cr->content_mode == 0 || cpi->Last_Source == NULL || |
| 413 | 416 | cpi->Last_Source->y_width != cpi->Source->y_width || |
| 414 | 417 | cpi->Last_Source->y_height != cpi->Source->y_height) |
| 415 | 418 | compute_content = 0; |
| @@ -430,7 +433,8 @@ static void cyclic_refresh_update_map(VP9_COMP *const cpi) { · 14 unmodified lines |
| 430 | 433 | // reset to 0 later depending on the coding mode. |
| 431 | 434 | if (cr->map[bl_index2] == 0) { |
| 432 | 435 | count_tot++; |
| 433 | | − if (cr->last_coded_q_map[bl_index2] > qindex_thresh || |
| 436 | + if (cr->content_mode == 0 || |
| 437 | + cr->last_coded_q_map[bl_index2] > qindex_thresh || |
| 434 | 438 | cpi->consec_zero_mv[bl_index2] < consec_zero_mv_thresh_block) { |
| 435 | 439 | sum_map++; |
| 436 | 440 | count_sel++; |
| @@ -489,7 +493,8 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) { · 52 unmodified lines |
| 489 | 493 | rc->avg_frame_qindex[INTER_FRAME] < qp_thresh || |
| 490 | 494 | (cpi->use_svc && |
| 491 | 495 | cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame) || |
| 492 | | − (!cpi->use_svc && rc->avg_frame_low_motion < thresh_low_motion && |
| 496 | + (!cpi->use_svc && cr->content_mode && |
| 497 | + rc->avg_frame_low_motion < thresh_low_motion && |
| 493 | 498 | rc->frames_since_key > 40) || |
| 494 | 499 | (!cpi->use_svc && rc->avg_frame_qindex[INTER_FRAME] > qp_max_thresh && |
| 495 | 500 | rc->frames_since_key > 20)) { |
| @@ -528,7 +533,7 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) { · 32 unmodified lines |
| 528 | 533 | cr->percent_refresh = (cr->skip_flat_static_blocks) ? 5 : 10; |
| 529 | 534 | // Increase the amount of refresh on scene change that is encoded at max Q, |
| 530 | 535 | // increase for a few cycles of the refresh period (~100 / percent_refresh). |
| 531 | | − if (cr->counter_encode_maxq_scene_change < 30) |
| 536 | + if (cr->content_mode && cr->counter_encode_maxq_scene_change < 30) |
| 532 | 537 | cr->percent_refresh = (cr->skip_flat_static_blocks) ? 10 : 15; |
| 533 | 538 | cr->rate_ratio_qdelta = 2.0; |
| 534 | 539 | cr->rate_boost_fac = 10; |
| @@ -575,6 +580,12 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) { · 40 unmodified lines |
| 575 | 580 | (double)(cr->actual_num_seg1_blocks + cr->actual_num_seg2_blocks) / |
| 576 | 581 | num8x8bl; |
| 577 | 582 | cr->weight_segment = weight_segment; |
| 583 | + if (cr->content_mode == 0) { |
| 584 | + cr->actual_num_seg1_blocks = |
| 585 | + cr->percent_refresh * cm->mi_rows * cm->mi_cols / 100; |
| 586 | + cr->actual_num_seg2_blocks = 0; |
| 587 | + cr->weight_segment = (double)(cr->actual_num_seg1_blocks) / num8x8bl; |
| 588 | + } |
| 578 | 589 | } |
| 579 | 590 | |
| 580 | 591 | // Setup cyclic background refresh: set delta q and segmentation map. |