Commit a4f74792 authored by Adrian Grange's avatar Adrian Grange
Browse files

Revert "Removing this_frame_stats member from TWO_PASS struct."

Use of stack frame variable "fps" beyond the lifetime of the function.

fps is sent as a paremeter to output_stats and stored in the
packet holding this encoded frame. This has scope beyond the
lifetime of the calling function.

This reverts commit 3f95a230

Change-Id: Icd8e14b3d7dd733590ada12e619b9dce95b6b0f5
Showing with 8 additions and 5 deletions
...@@ -495,7 +495,6 @@ void vp9_first_pass(VP9_COMP *cpi) { ...@@ -495,7 +495,6 @@ 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;
FIRSTPASS_STATS fps;
vp9_clear_system_state(); vp9_clear_system_state();
...@@ -790,6 +789,8 @@ void vp9_first_pass(VP9_COMP *cpi) { ...@@ -790,6 +789,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
vp9_clear_system_state(); vp9_clear_system_state();
{ {
FIRSTPASS_STATS fps;
fps.frame = cm->current_video_frame; fps.frame = cm->current_video_frame;
fps.spatial_layer_id = cpi->svc.spatial_layer_id; fps.spatial_layer_id = cpi->svc.spatial_layer_id;
fps.intra_error = (double)(intra_error >> 8); fps.intra_error = (double)(intra_error >> 8);
...@@ -829,7 +830,8 @@ void vp9_first_pass(VP9_COMP *cpi) { ...@@ -829,7 +830,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
fps.duration = (double)(cpi->source->ts_end - cpi->source->ts_start); fps.duration = (double)(cpi->source->ts_end - cpi->source->ts_start);
// Don't want to do output stats with a stack variable! // Don't want to do output stats with a stack variable!
output_stats(&fps, cpi->output_pkt_list); twopass->this_frame_stats = fps;
output_stats(&twopass->this_frame_stats, cpi->output_pkt_list);
accumulate_stats(&twopass->total_stats, &fps); accumulate_stats(&twopass->total_stats, &fps);
} }
...@@ -837,9 +839,9 @@ void vp9_first_pass(VP9_COMP *cpi) { ...@@ -837,9 +839,9 @@ void vp9_first_pass(VP9_COMP *cpi) {
// the prediction is good enough... but also don't allow it to lag too far. // the prediction is good enough... but also don't allow it to lag too far.
if ((twopass->sr_update_lag > 3) || if ((twopass->sr_update_lag > 3) ||
((cm->current_video_frame > 0) && ((cm->current_video_frame > 0) &&
(fps.pcnt_inter > 0.20) && (twopass->this_frame_stats.pcnt_inter > 0.20) &&
((fps.intra_error / ((twopass->this_frame_stats.intra_error /
DOUBLE_DIVIDE_CHECK(fps.coded_error)) > 2.0))) { DOUBLE_DIVIDE_CHECK(twopass->this_frame_stats.coded_error)) > 2.0))) {
if (gld_yv12 != NULL) { if (gld_yv12 != NULL) {
vp8_yv12_copy_frame(lst_yv12, gld_yv12); vp8_yv12_copy_frame(lst_yv12, gld_yv12);
} }
......
...@@ -44,6 +44,7 @@ typedef struct { ...@@ -44,6 +44,7 @@ typedef struct {
unsigned int section_intra_rating; unsigned int section_intra_rating;
unsigned int next_iiratio; unsigned int next_iiratio;
FIRSTPASS_STATS total_stats; FIRSTPASS_STATS total_stats;
FIRSTPASS_STATS this_frame_stats;
const FIRSTPASS_STATS *stats_in; const FIRSTPASS_STATS *stats_in;
const FIRSTPASS_STATS *stats_in_start; const FIRSTPASS_STATS *stats_in_start;
const FIRSTPASS_STATS *stats_in_end; const FIRSTPASS_STATS *stats_in_end;
......
Supports Markdown
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