Commit d735cd5e authored by Jim Bankoski's avatar Jim Bankoski Committed by Gerrit Code Review
Browse files

Merge "vp9_firstpass.c : clear warning re: use of null lc"

parents 4d98b50b b78f8f67
...@@ -432,6 +432,8 @@ void vp9_first_pass(VP9_COMP *cpi) { ...@@ -432,6 +432,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
TWO_PASS *twopass = &cpi->twopass; TWO_PASS *twopass = &cpi->twopass;
const MV zero_mv = {0, 0}; const MV zero_mv = {0, 0};
const YV12_BUFFER_CONFIG *first_ref_buf = lst_yv12; const YV12_BUFFER_CONFIG *first_ref_buf = lst_yv12;
LAYER_CONTEXT *const lc = is_spatial_svc(cpi) ?
&cpi->svc.layer_context[cpi->svc.spatial_layer_id] : 0;
#if CONFIG_FP_MB_STATS #if CONFIG_FP_MB_STATS
if (cpi->use_fp_mb_stats) { if (cpi->use_fp_mb_stats) {
...@@ -444,15 +446,14 @@ void vp9_first_pass(VP9_COMP *cpi) { ...@@ -444,15 +446,14 @@ void vp9_first_pass(VP9_COMP *cpi) {
set_first_pass_params(cpi); set_first_pass_params(cpi);
vp9_set_quantizer(cm, find_fp_qindex()); vp9_set_quantizer(cm, find_fp_qindex());
if (is_spatial_svc(cpi)) { if (lc != NULL) {
MV_REFERENCE_FRAME ref_frame = LAST_FRAME; MV_REFERENCE_FRAME ref_frame = LAST_FRAME;
const YV12_BUFFER_CONFIG *scaled_ref_buf = NULL; const YV12_BUFFER_CONFIG *scaled_ref_buf = NULL;
twopass = &cpi->svc.layer_context[cpi->svc.spatial_layer_id].twopass; twopass = &lc->twopass;
if (cpi->common.current_video_frame == 0) { if (cpi->common.current_video_frame == 0) {
cpi->ref_frame_flags = 0; cpi->ref_frame_flags = 0;
} else { } else {
LAYER_CONTEXT *lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
if (lc->current_video_frame_in_layer == 0) if (lc->current_video_frame_in_layer == 0)
cpi->ref_frame_flags = VP9_GOLD_FLAG; cpi->ref_frame_flags = VP9_GOLD_FLAG;
else else
...@@ -613,7 +614,7 @@ void vp9_first_pass(VP9_COMP *cpi) { ...@@ -613,7 +614,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
&unscaled_last_source_buf_2d); &unscaled_last_source_buf_2d);
// TODO(pengchong): Replace the hard-coded threshold // TODO(pengchong): Replace the hard-coded threshold
if (raw_motion_error > 25 || is_spatial_svc(cpi)) { if (raw_motion_error > 25 || lc != NULL) {
// Test last reference frame using the previous best mv as the // Test last reference frame using the previous best mv as the
// starting point (best reference) for the search. // starting point (best reference) for the search.
first_pass_motion_search(cpi, x, &best_ref_mv.as_mv, &mv.as_mv, first_pass_motion_search(cpi, x, &best_ref_mv.as_mv, &mv.as_mv,
...@@ -895,7 +896,7 @@ void vp9_first_pass(VP9_COMP *cpi) { ...@@ -895,7 +896,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
vp9_extend_frame_borders(new_yv12); vp9_extend_frame_borders(new_yv12);
if (is_spatial_svc(cpi)) { if (lc != NULL) {
vp9_update_reference_frames(cpi); vp9_update_reference_frames(cpi);
} else { } else {
// Swap frame pointers so last frame refers to the frame we just compressed. // Swap frame pointers so last frame refers to the frame we just compressed.
...@@ -1554,8 +1555,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { ...@@ -1554,8 +1555,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
vp9_clear_system_state(); vp9_clear_system_state();
vp9_zero(next_frame); vp9_zero(next_frame);
gf_group_bits = 0;
// Load stats for the current frame. // Load stats for the current frame.
mod_frame_err = calculate_modified_err(twopass, oxcf, this_frame); mod_frame_err = calculate_modified_err(twopass, oxcf, this_frame);
...@@ -2124,10 +2123,10 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { ...@@ -2124,10 +2123,10 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
FIRSTPASS_STATS this_frame_copy; FIRSTPASS_STATS this_frame_copy;
int target_rate; int target_rate;
LAYER_CONTEXT *lc = NULL; LAYER_CONTEXT *const lc = is_spatial_svc(cpi) ?
&cpi->svc.layer_context[cpi->svc.spatial_layer_id] : 0;
if (is_spatial_svc(cpi)) { if (lc != NULL) {
lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
frames_left = (int)(twopass->total_stats.count - frames_left = (int)(twopass->total_stats.count -
lc->current_video_frame_in_layer); lc->current_video_frame_in_layer);
} else { } else {
...@@ -2154,7 +2153,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { ...@@ -2154,7 +2153,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
vp9_rc_set_frame_target(cpi, target_rate); vp9_rc_set_frame_target(cpi, target_rate);
cm->frame_type = INTER_FRAME; cm->frame_type = INTER_FRAME;
if (is_spatial_svc(cpi)) { if (lc != NULL) {
if (cpi->svc.spatial_layer_id == 0) { if (cpi->svc.spatial_layer_id == 0) {
lc->is_key_frame = 0; lc->is_key_frame = 0;
} else { } else {
...@@ -2170,7 +2169,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { ...@@ -2170,7 +2169,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
vp9_clear_system_state(); vp9_clear_system_state();
if (is_spatial_svc(cpi) && twopass->kf_intra_err_min == 0) { if (lc != NULL && twopass->kf_intra_err_min == 0) {
twopass->kf_intra_err_min = KF_MB_INTRA_MIN * cpi->common.MBs; twopass->kf_intra_err_min = KF_MB_INTRA_MIN * cpi->common.MBs;
twopass->gf_intra_err_min = GF_MB_INTRA_MIN * cpi->common.MBs; twopass->gf_intra_err_min = GF_MB_INTRA_MIN * cpi->common.MBs;
} }
...@@ -2178,8 +2177,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { ...@@ -2178,8 +2177,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
if (cpi->oxcf.rc_mode == VPX_Q) { if (cpi->oxcf.rc_mode == VPX_Q) {
twopass->active_worst_quality = cpi->oxcf.cq_level; twopass->active_worst_quality = cpi->oxcf.cq_level;
} else if (cm->current_video_frame == 0 || } else if (cm->current_video_frame == 0 ||
(is_spatial_svc(cpi) && (lc != NULL && lc->current_video_frame_in_layer == 0)) {
lc->current_video_frame_in_layer == 0)) {
// Special case code for first frame. // Special case code for first frame.
const int section_target_bandwidth = (int)(twopass->bits_left / const int section_target_bandwidth = (int)(twopass->bits_left /
frames_left); frames_left);
...@@ -2205,7 +2203,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { ...@@ -2205,7 +2203,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
cm->frame_type = INTER_FRAME; cm->frame_type = INTER_FRAME;
} }
if (is_spatial_svc(cpi)) { if (lc != NULL) {
if (cpi->svc.spatial_layer_id == 0) { if (cpi->svc.spatial_layer_id == 0) {
lc->is_key_frame = (cm->frame_type == KEY_FRAME); lc->is_key_frame = (cm->frame_type == KEY_FRAME);
if (lc->is_key_frame) if (lc->is_key_frame)
...@@ -2236,7 +2234,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { ...@@ -2236,7 +2234,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
} }
rc->frames_till_gf_update_due = rc->baseline_gf_interval; rc->frames_till_gf_update_due = rc->baseline_gf_interval;
if (!is_spatial_svc(cpi)) if (lc != NULL)
cpi->refresh_golden_frame = 1; cpi->refresh_golden_frame = 1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment