summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorJacky Chen <jackychen@google.com>2015-10-29 21:00:36 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-10-29 21:00:36 +0000
commit039f241fc2e32b61ca8ea1cec3715a8a9abbe0b2 (patch)
treefde5e891e8eac70db83b9daec29c0bcc8911a85d /vp9
parent6f229b3e62549045ec12b955148dba56e4496cac (diff)
parentdba2d5b3f3e80e8bdeca4af77d0b8632bf471e77 (diff)
downloadlibvpx-039f241fc2e32b61ca8ea1cec3715a8a9abbe0b2.tar
libvpx-039f241fc2e32b61ca8ea1cec3715a8a9abbe0b2.tar.gz
libvpx-039f241fc2e32b61ca8ea1cec3715a8a9abbe0b2.tar.bz2
libvpx-039f241fc2e32b61ca8ea1cec3715a8a9abbe0b2.zip
Merge "VP9_resizing: add limitation to the downsacling resolution."
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_ratectrl.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 93cf2ccdd..c6fe76cff 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1836,6 +1836,9 @@ int vp9_resize_one_pass_cbr(VP9_COMP *cpi) {
RESIZE_ACTION resize_action = NO_RESIZE;
int avg_qp_thr1 = 70;
int avg_qp_thr2 = 50;
+ int min_width = 180;
+ int min_height = 180;
+ int down_size_on = 1;
cpi->resize_scale_num = 1;
cpi->resize_scale_den = 1;
// Don't resize on key frame; reset the counters on key frame.
@@ -1844,6 +1847,21 @@ int vp9_resize_one_pass_cbr(VP9_COMP *cpi) {
cpi->resize_count = 0;
return 0;
}
+ // Check current frame reslution to avoid generating frames smaller than
+ // the minimum resolution.
+ if (ONEHALFONLY_RESIZE) {
+ if ((cm->width >> 1) < min_width || (cm->height >> 1) < min_height)
+ down_size_on = 0;
+ } else {
+ if (cpi->resize_state == ORIG &&
+ (cm->width * 3 / 4 < min_width ||
+ cm->height * 3 / 4 < min_height))
+ return 0;
+ else if (cpi->resize_state == THREE_QUARTER &&
+ ((cpi->oxcf.width >> 1) < min_width ||
+ (cpi->oxcf.height >> 1) < min_height))
+ down_size_on = 0;
+ }
#if CONFIG_VP9_TEMPORAL_DENOISING
// If denoiser is on, apply a smaller qp threshold.
@@ -1870,7 +1888,7 @@ int vp9_resize_one_pass_cbr(VP9_COMP *cpi) {
// down state, i.e. 1/2 or 3/4 of original resolution.
// Currently, use a flag to turn 3/4 resizing feature on/off.
if (cpi->resize_buffer_underflow > (cpi->resize_count >> 2)) {
- if (cpi->resize_state == THREE_QUARTER) {
+ if (cpi->resize_state == THREE_QUARTER && down_size_on) {
resize_action = DOWN_ONEHALF;
cpi->resize_state = ONE_HALF;
} else if (cpi->resize_state == ORIG) {