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 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 VP9_COMMON *const cm = &cpi->common; | 1228 VP9_COMMON *const cm = &cpi->common; |
1229 RATE_CONTROL *const rc = &cpi->rc; | 1229 RATE_CONTROL *const rc = &cpi->rc; |
1230 int target = rc->avg_frame_bandwidth; | 1230 int target = rc->avg_frame_bandwidth; |
1231 if ((cm->current_video_frame == 0) || | 1231 if ((cm->current_video_frame == 0) || |
1232 (cpi->frame_flags & FRAMEFLAGS_KEY) || | 1232 (cpi->frame_flags & FRAMEFLAGS_KEY) || |
1233 (cpi->oxcf.auto_key && (rc->frames_since_key % | 1233 (cpi->oxcf.auto_key && (rc->frames_since_key % |
1234 cpi->oxcf.key_freq == 0))) { | 1234 cpi->oxcf.key_freq == 0))) { |
1235 cm->frame_type = KEY_FRAME; | 1235 cm->frame_type = KEY_FRAME; |
1236 rc->source_alt_ref_active = 0; | 1236 rc->source_alt_ref_active = 0; |
1237 | 1237 |
1238 if (is_spatial_svc(cpi)) { | 1238 if (is_two_pass_svc(cpi)) { |
1239 cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame = 1; | 1239 cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame = 1; |
1240 cpi->ref_frame_flags &= | 1240 cpi->ref_frame_flags &= |
1241 (~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG); | 1241 (~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG); |
1242 } | 1242 } |
1243 | 1243 |
1244 if (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) { | 1244 if (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) { |
1245 target = calc_iframe_target_size_one_pass_cbr(cpi); | 1245 target = calc_iframe_target_size_one_pass_cbr(cpi); |
1246 } | 1246 } |
1247 } else { | 1247 } else { |
1248 cm->frame_type = INTER_FRAME; | 1248 cm->frame_type = INTER_FRAME; |
1249 | 1249 |
1250 if (is_spatial_svc(cpi)) { | 1250 if (is_two_pass_svc(cpi)) { |
1251 LAYER_CONTEXT *lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id]; | 1251 LAYER_CONTEXT *lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id]; |
1252 if (cpi->svc.spatial_layer_id == 0) { | 1252 if (cpi->svc.spatial_layer_id == 0) { |
1253 lc->is_key_frame = 0; | 1253 lc->is_key_frame = 0; |
1254 } else { | 1254 } else { |
1255 lc->is_key_frame = cpi->svc.layer_context[0].is_key_frame; | 1255 lc->is_key_frame = cpi->svc.layer_context[0].is_key_frame; |
1256 if (lc->is_key_frame) | 1256 if (lc->is_key_frame) |
1257 cpi->ref_frame_flags &= (~VP9_LAST_FLAG); | 1257 cpi->ref_frame_flags &= (~VP9_LAST_FLAG); |
1258 } | 1258 } |
1259 cpi->ref_frame_flags &= (~VP9_ALT_FLAG); | 1259 cpi->ref_frame_flags &= (~VP9_ALT_FLAG); |
1260 } | 1260 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 // a very high rate is given on the command line or the the rate cannnot | 1376 // a very high rate is given on the command line or the the rate cannnot |
1377 // be acheived because of a user specificed max q (e.g. when the user | 1377 // be acheived because of a user specificed max q (e.g. when the user |
1378 // specifies lossless encode. | 1378 // specifies lossless encode. |
1379 vbr_max_bits = (int)(((int64_t)rc->avg_frame_bandwidth * | 1379 vbr_max_bits = (int)(((int64_t)rc->avg_frame_bandwidth * |
1380 oxcf->two_pass_vbrmax_section) / 100); | 1380 oxcf->two_pass_vbrmax_section) / 100); |
1381 rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P), | 1381 rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P), |
1382 vbr_max_bits); | 1382 vbr_max_bits); |
1383 | 1383 |
1384 vp9_rc_set_gf_max_interval(cpi, rc); | 1384 vp9_rc_set_gf_max_interval(cpi, rc); |
1385 } | 1385 } |
OLD | NEW |