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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 lrc->decimation_factor = 0; | 70 lrc->decimation_factor = 0; |
71 | 71 |
72 for (i = 0; i < RATE_FACTOR_LEVELS; ++i) { | 72 for (i = 0; i < RATE_FACTOR_LEVELS; ++i) { |
73 lrc->rate_correction_factors[i] = 1.0; | 73 lrc->rate_correction_factors[i] = 1.0; |
74 } | 74 } |
75 | 75 |
76 if (svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) { | 76 if (svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) { |
77 lc->target_bandwidth = oxcf->ts_target_bitrate[layer]; | 77 lc->target_bandwidth = oxcf->ts_target_bitrate[layer]; |
78 lrc->last_q[INTER_FRAME] = oxcf->worst_allowed_q; | 78 lrc->last_q[INTER_FRAME] = oxcf->worst_allowed_q; |
79 lrc->avg_frame_qindex[INTER_FRAME] = oxcf->worst_allowed_q; | 79 lrc->avg_frame_qindex[INTER_FRAME] = oxcf->worst_allowed_q; |
| 80 lrc->avg_frame_qindex[KEY_FRAME] = oxcf->worst_allowed_q; |
80 } else { | 81 } else { |
81 lc->target_bandwidth = oxcf->ss_target_bitrate[layer]; | 82 lc->target_bandwidth = oxcf->ss_target_bitrate[layer]; |
82 lrc->last_q[KEY_FRAME] = oxcf->best_allowed_q; | 83 lrc->last_q[KEY_FRAME] = oxcf->best_allowed_q; |
83 lrc->last_q[INTER_FRAME] = oxcf->best_allowed_q; | 84 lrc->last_q[INTER_FRAME] = oxcf->best_allowed_q; |
84 lrc->avg_frame_qindex[KEY_FRAME] = (oxcf->worst_allowed_q + | 85 lrc->avg_frame_qindex[KEY_FRAME] = (oxcf->worst_allowed_q + |
85 oxcf->best_allowed_q) / 2; | 86 oxcf->best_allowed_q) / 2; |
86 lrc->avg_frame_qindex[INTER_FRAME] = (oxcf->worst_allowed_q + | 87 lrc->avg_frame_qindex[INTER_FRAME] = (oxcf->worst_allowed_q + |
87 oxcf->best_allowed_q) / 2; | 88 oxcf->best_allowed_q) / 2; |
88 if (oxcf->ss_play_alternate[layer]) | 89 if (oxcf->ss_enable_auto_arf[layer]) |
89 lc->alt_ref_idx = alt_ref_idx++; | 90 lc->alt_ref_idx = alt_ref_idx++; |
90 else | 91 else |
91 lc->alt_ref_idx = -1; | 92 lc->alt_ref_idx = -1; |
92 lc->gold_ref_idx = -1; | 93 lc->gold_ref_idx = -1; |
93 } | 94 } |
94 | 95 |
95 lrc->buffer_level = oxcf->starting_buffer_level_ms * | 96 lrc->buffer_level = oxcf->starting_buffer_level_ms * |
96 lc->target_bandwidth / 1000; | 97 lc->target_bandwidth / 1000; |
97 lrc->bits_off_target = lrc->buffer_level; | 98 lrc->bits_off_target = lrc->buffer_level; |
98 } | 99 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 cpi->gld_fb_idx = cpi->svc.spatial_layer_id - 1; | 299 cpi->gld_fb_idx = cpi->svc.spatial_layer_id - 1; |
299 | 300 |
300 if (lc->current_video_frame_in_layer == 0) { | 301 if (lc->current_video_frame_in_layer == 0) { |
301 if (cpi->svc.spatial_layer_id >= 2) { | 302 if (cpi->svc.spatial_layer_id >= 2) { |
302 cpi->alt_fb_idx = cpi->svc.spatial_layer_id - 2; | 303 cpi->alt_fb_idx = cpi->svc.spatial_layer_id - 2; |
303 } else { | 304 } else { |
304 cpi->alt_fb_idx = cpi->lst_fb_idx; | 305 cpi->alt_fb_idx = cpi->lst_fb_idx; |
305 cpi->ref_frame_flags &= (~VP9_LAST_FLAG & ~VP9_ALT_FLAG); | 306 cpi->ref_frame_flags &= (~VP9_LAST_FLAG & ~VP9_ALT_FLAG); |
306 } | 307 } |
307 } else { | 308 } else { |
308 if (cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id]) { | 309 if (cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id]) { |
309 cpi->alt_fb_idx = lc->alt_ref_idx; | 310 cpi->alt_fb_idx = lc->alt_ref_idx; |
310 if (!lc->has_alt_frame) | 311 if (!lc->has_alt_frame) |
311 cpi->ref_frame_flags &= (~VP9_ALT_FLAG); | 312 cpi->ref_frame_flags &= (~VP9_ALT_FLAG); |
312 } else { | 313 } else { |
313 // Find a proper alt_fb_idx for layers that don't have alt ref frame | 314 // Find a proper alt_fb_idx for layers that don't have alt ref frame |
314 if (cpi->svc.spatial_layer_id == 0) { | 315 if (cpi->svc.spatial_layer_id == 0) { |
315 cpi->alt_fb_idx = cpi->lst_fb_idx; | 316 cpi->alt_fb_idx = cpi->lst_fb_idx; |
316 } else { | 317 } else { |
317 LAYER_CONTEXT *lc_lower = | 318 LAYER_CONTEXT *lc_lower = |
318 &cpi->svc.layer_context[cpi->svc.spatial_layer_id - 1]; | 319 &cpi->svc.layer_context[cpi->svc.spatial_layer_id - 1]; |
319 | 320 |
320 if (cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id - 1] && | 321 if (cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id - 1] && |
321 lc_lower->alt_ref_source != NULL) | 322 lc_lower->alt_ref_source != NULL) |
322 cpi->alt_fb_idx = lc_lower->alt_ref_idx; | 323 cpi->alt_fb_idx = lc_lower->alt_ref_idx; |
323 else if (cpi->svc.spatial_layer_id >= 2) | 324 else if (cpi->svc.spatial_layer_id >= 2) |
324 cpi->alt_fb_idx = cpi->svc.spatial_layer_id - 2; | 325 cpi->alt_fb_idx = cpi->svc.spatial_layer_id - 2; |
325 else | 326 else |
326 cpi->alt_fb_idx = cpi->lst_fb_idx; | 327 cpi->alt_fb_idx = cpi->lst_fb_idx; |
327 } | 328 } |
328 } | 329 } |
329 } | 330 } |
330 | 331 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 // Only remove the buffer when pop the highest layer. | 398 // Only remove the buffer when pop the highest layer. |
398 if (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1) { | 399 if (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1) { |
399 vp9_lookahead_pop(ctx, drain); | 400 vp9_lookahead_pop(ctx, drain); |
400 } | 401 } |
401 } | 402 } |
402 } | 403 } |
403 | 404 |
404 return buf; | 405 return buf; |
405 } | 406 } |
406 #endif | 407 #endif |
OLD | NEW |