summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorjackychen <jackychen@google.com>2015-09-21 09:37:46 -0700
committerjackychen <jackychen@google.com>2015-09-21 10:57:05 -0700
commit55f092db09e0bec0f953f77830ac8ac6bb67fdf9 (patch)
tree7e2125b4ff53bd4e2a94eeb7d8f553b8581ccdbd /vp9/encoder
parent67ec82a2620b890e9a0ccbf446b1447f8ab3a80d (diff)
downloadlibvpx-55f092db09e0bec0f953f77830ac8ac6bb67fdf9.tar
libvpx-55f092db09e0bec0f953f77830ac8ac6bb67fdf9.tar.gz
libvpx-55f092db09e0bec0f953f77830ac8ac6bb67fdf9.tar.bz2
libvpx-55f092db09e0bec0f953f77830ac8ac6bb67fdf9.zip
Change size on first frame and change config cause crash.
Reallocation of mi buffer fails if change size on the first frame and change config in subsequent frames. Add a condition for resolution check to avoid assertion failure. BUG=1074 Change-Id: Ie26ed816a57fa871ba27a72db9805baaaeaba9f3
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_encoder.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 91e92ff24..eb0d3608f 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1517,7 +1517,10 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
}
if (cpi->initial_width) {
- if (cm->width > cpi->initial_width || cm->height > cpi->initial_height) {
+ int new_mi_size = 0;
+ vp9_set_mb_mi(cm, cm->width, cm->height);
+ new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows);
+ if (cm->mi_alloc_size < new_mi_size) {
vp9_free_context_buffers(cm);
alloc_compressor_data(cpi);
realloc_segmentation_maps(cpi);
@@ -4642,8 +4645,10 @@ int vp9_set_internal_size(VP9_COMP *cpi,
// always go to the next whole number
cm->width = (hs - 1 + cpi->oxcf.width * hr) / hs;
cm->height = (vs - 1 + cpi->oxcf.height * vr) / vs;
- assert(cm->width <= cpi->initial_width);
- assert(cm->height <= cpi->initial_height);
+ if (cm->current_video_frame) {
+ assert(cm->width <= cpi->initial_width);
+ assert(cm->height <= cpi->initial_height);
+ }
update_frame_size(cpi);