Commit b862c108 authored by Paul Wilkins's avatar Paul Wilkins
Browse files

Overflow of frame error accumulators.

This fixes an overflow problem in the frame error accumulators.

The overflow condition is extreme but did trigger when Frank B.
coded some high motion interlaced HD content.

The observed effect was a catastrophic  breakdown of the rate
control leading to massive undershoot and poor bit allocation.

All the error values should really be unsigned but I will look at this
separately.

Change-Id: I9745f5c5ca2783620426b66b568b2088b579151f
parent aee120af
...@@ -560,8 +560,8 @@ void vp8_first_pass(VP8_COMP *cpi) ...@@ -560,8 +560,8 @@ void vp8_first_pass(VP8_COMP *cpi)
YV12_BUFFER_CONFIG *gld_yv12 = &cm->yv12_fb[cm->gld_fb_idx]; YV12_BUFFER_CONFIG *gld_yv12 = &cm->yv12_fb[cm->gld_fb_idx];
int recon_y_stride = lst_yv12->y_stride; int recon_y_stride = lst_yv12->y_stride;
int recon_uv_stride = lst_yv12->uv_stride; int recon_uv_stride = lst_yv12->uv_stride;
int intra_error = 0; long long intra_error = 0;
int coded_error = 0; long long coded_error = 0;
int sum_mvr = 0, sum_mvc = 0; int sum_mvr = 0, sum_mvc = 0;
int sum_mvr_abs = 0, sum_mvc_abs = 0; int sum_mvr_abs = 0, sum_mvc_abs = 0;
...@@ -648,7 +648,7 @@ void vp8_first_pass(VP8_COMP *cpi) ...@@ -648,7 +648,7 @@ void vp8_first_pass(VP8_COMP *cpi)
this_error += intrapenalty; this_error += intrapenalty;
// Cumulative intra error total // Cumulative intra error total
intra_error += this_error; intra_error += (long long)this_error;
// Indicate default assumption of intra in the motion map // Indicate default assumption of intra in the motion map
*fp_motion_map_ptr = 0; *fp_motion_map_ptr = 0;
...@@ -800,7 +800,7 @@ void vp8_first_pass(VP8_COMP *cpi) ...@@ -800,7 +800,7 @@ void vp8_first_pass(VP8_COMP *cpi)
} }
} }
coded_error += this_error; coded_error += (long long)this_error;
// adjust to the next column of macroblocks // adjust to the next column of macroblocks
x->src.y_buffer += 16; x->src.y_buffer += 16;
......
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