diff options
-rw-r--r-- | test/resize_test.cc | 16 | ||||
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 15 |
2 files changed, 28 insertions, 3 deletions
diff --git a/test/resize_test.cc b/test/resize_test.cc index 1c9ef2280..c5f05f310 100644 --- a/test/resize_test.cc +++ b/test/resize_test.cc @@ -127,6 +127,20 @@ unsigned int ScaleForFrameNumber(unsigned int frame, unsigned int val) { return val / 2; if (frame < 180) return val * 3 / 4; + if (frame < 190) + return val; + if (frame < 200) + return val * 3 / 4; + if (frame < 210) + return val / 2; + if (frame < 220) + return val * 3 / 4; + if (frame < 230) + return val; + if (frame < 240) + return val / 2; + if (frame < 250) + return val * 3 / 4; return val; } @@ -134,7 +148,7 @@ class ResizingVideoSource : public ::libvpx_test::DummyVideoSource { public: ResizingVideoSource() { SetSize(kInitialWidth, kInitialHeight); - limit_ = 200; + limit_ = 300; } virtual ~ResizingVideoSource() {} diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 65d5d76a7..bd9813a77 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2975,8 +2975,19 @@ void vp9_scale_references(VP9_COMP *cpi) { } #endif // CONFIG_VP9_HIGHBITDEPTH } else { - const int buf_idx = get_ref_frame_buf_idx(cpi, ref_frame); - RefCntBuffer *const buf = &pool->frame_bufs[buf_idx]; + int buf_idx; + RefCntBuffer *buf = NULL; + if (cpi->oxcf.pass == 0 && !cpi->use_svc) { + // Check for release of scaled reference. + buf_idx = cpi->scaled_ref_idx[ref_frame - 1]; + buf = (buf_idx != INVALID_IDX) ? &pool->frame_bufs[buf_idx] : NULL; + if (buf != NULL) { + --buf->ref_count; + cpi->scaled_ref_idx[ref_frame - 1] = INVALID_IDX; + } + } + buf_idx = get_ref_frame_buf_idx(cpi, ref_frame); + buf = &pool->frame_bufs[buf_idx]; buf->buf.y_crop_width = ref->y_crop_width; buf->buf.y_crop_height = ref->y_crop_height; cpi->scaled_ref_idx[ref_frame - 1] = buf_idx; |