From: Marco Paniconi Date: Mon, 30 Mar 2020 16:16:09 +0000 (-0700) Subject: rtc: Increase resize limit resoln for rtc X-Git-Tag: v1.9.0-rc1~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b0422ad096c64bef9d7f972c092f5090510bdc1;p=libvpx rtc: Increase resize limit resoln for rtc Increase resize limit to avoid resized frame from going below 320x180. Change-Id: If736ac3fac4731b47844e4d8c771ecf5c66550de --- diff --git a/test/resize_test.cc b/test/resize_test.cc index 5f323db5a..d996cbe1b 100644 --- a/test/resize_test.cc +++ b/test/resize_test.cc @@ -610,11 +610,11 @@ TEST_P(ResizeRealtimeTest, DISABLED_TestExternalResizeSmallerWidthBiggerSize) { // Run at low bitrate, with resize_allowed = 1, and verify that we get // one resize down event. TEST_P(ResizeRealtimeTest, TestInternalResizeDown) { - ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, - 30, 1, 0, 299); + ::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1, + 0, 299); DefaultConfig(); - cfg_.g_w = 352; - cfg_.g_h = 288; + cfg_.g_w = 640; + cfg_.g_h = 480; change_bitrate_ = false; mismatch_psnr_ = 0.0; mismatch_nframes_ = 0; @@ -648,11 +648,11 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDown) { // Start at low target bitrate, raise the bitrate in the middle of the clip, // scaling-up should occur after bitrate changed. TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) { - ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, - 30, 1, 0, 359); + ::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1, + 0, 400); DefaultConfig(); - cfg_.g_w = 352; - cfg_.g_h = 288; + cfg_.g_w = 640; + cfg_.g_h = 480; change_bitrate_ = true; mismatch_psnr_ = 0.0; mismatch_nframes_ = 0; diff --git a/test/svc_datarate_test.cc b/test/svc_datarate_test.cc index f995e4c08..7260d8ec8 100644 --- a/test/svc_datarate_test.cc +++ b/test/svc_datarate_test.cc @@ -337,7 +337,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc { } else if (dynamic_drop_layer_ && single_layer_resize_) { // Change layer bitrates to set top layers to 0. This will trigger skip // encoding/dropping of top spatial layers. - if (video->frame() == 10) { + if (video->frame() == 2) { cfg_.rc_target_bitrate -= (cfg_.layer_target_bitrate[1] + cfg_.layer_target_bitrate[2]); middle_bitrate_ = cfg_.layer_target_bitrate[1]; @@ -348,9 +348,9 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc { cfg_.layer_target_bitrate[0] = 30; cfg_.rc_target_bitrate = cfg_.layer_target_bitrate[0]; encoder->Config(&cfg_); - } else if (video->frame() == 300) { + } else if (video->frame() == 100) { // Set base spatial layer to very high to go back up to original size. - cfg_.layer_target_bitrate[0] = 300; + cfg_.layer_target_bitrate[0] = 400; cfg_.rc_target_bitrate = cfg_.layer_target_bitrate[0]; encoder->Config(&cfg_); } @@ -838,7 +838,7 @@ TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc3SL_DisableEnableLayers) { // the fly switching to 1 spatial layer with dynamic resize enabled. // The resizer will resize the single layer down and back up again, as the // bitrate goes back up. -TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc3SL_SingleLayerResize) { +TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc2SL_SingleLayerResize) { SetSvcConfig(2, 1); cfg_.rc_buf_initial_sz = 500; cfg_.rc_buf_optimal_sz = 500; @@ -850,10 +850,10 @@ TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc3SL_SingleLayerResize) { cfg_.rc_dropframe_thresh = 30; cfg_.kf_max_dist = 9999; cfg_.rc_resize_allowed = 1; - ::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1, - 0, 400); - top_sl_width_ = 640; - top_sl_height_ = 480; + ::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv", 1280, + 720, 15, 1, 0, 300); + top_sl_width_ = 1280; + top_sl_height_ = 720; cfg_.rc_target_bitrate = 800; ResetModel(); dynamic_drop_layer_ = true; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index b1d5d1b96..df4a07212 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -2657,8 +2657,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 = 320; - int min_height = 180; + // Don't allow for resized frame to go below 320x180, resize in steps of 3/4. + int min_width = (320 * 4) / 3; + int min_height = (180 * 4) / 3; int down_size_on = 1; cpi->resize_scale_num = 1; cpi->resize_scale_den = 1; @@ -2670,7 +2671,7 @@ int vp9_resize_one_pass_cbr(VP9_COMP *cpi) { } // No resizing down if frame size is below some limit. - if (cm->width * cm->height <= min_width * min_height) down_size_on = 0; + if ((cm->width * cm->height) < min_width * min_height) down_size_on = 0; #if CONFIG_VP9_TEMPORAL_DENOISING // If denoiser is on, apply a smaller qp threshold.