Add count on expected number of resizes, and use the speed_setting_ for base layer. Also allow AQ_MODE=3 for the tests with dynamic layer disabling/enabling.
Showing the changes to test (1 of 1 file). Show all
Unified · Split
| @@ -78,6 +78,12 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc { · 77 unmodified lines | ||
| 78 | 78 | use_post_encode_drop_ = 0; |
| 79 | 79 | denoiser_off_on_ = false; |
| 80 | 80 | denoiser_enable_layers_ = false; |
| 81 | + num_resize_down_ = 0; | |
| 82 | + num_resize_up_ = 0; | |
| 83 | + for (int i = 0; i < VPX_MAX_LAYERS; i++) { | |
| 84 | + prev_frame_width[i] = 320; | |
| 85 | + prev_frame_height[i] = 240; | |
| 86 | + } | |
| 81 | 87 | } |
| 82 | 88 | virtual void BeginPassHook(unsigned int /*pass*/) {} |
| 83 | 89 | |
| @@ -287,8 +293,6 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc { · 203 unmodified lines | ||
| 287 | 293 | } |
| 288 | 294 | |
| 289 | 295 | if (dynamic_drop_layer_ && !single_layer_resize_) { |
| 290 | − // TODO(jian): Disable AQ Mode for this test for now. | |
| 291 | − encoder->Control(VP9E_SET_AQ_MODE, 0); | |
| 292 | 296 | if (video->frame() == 0) { |
| 293 | 297 | // Change layer bitrates to set top layers to 0. This will trigger skip |
| 294 | 298 | // encoding/dropping of top two spatial layers. |
| @@ -511,7 +515,16 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc { · 216 unmodified lines | ||
| 511 | 515 | ASSERT_EQ(pkt->data.frame.height[sl], |
| 512 | 516 | top_sl_height_ * svc_params_.scaling_factor_num[sl] / |
| 513 | 517 | svc_params_.scaling_factor_den[sl]); |
| 518 | + } else if (superframe_count_ > 0) { | |
| 519 | + if (pkt->data.frame.width[sl] < prev_frame_width[sl] && | |
| 520 | + pkt->data.frame.height[sl] < prev_frame_height[sl]) | |
| 521 | + num_resize_down_ += 1; | |
| 522 | + if (pkt->data.frame.width[sl] > prev_frame_width[sl] && | |
| 523 | + pkt->data.frame.height[sl] > prev_frame_height[sl]) | |
| 524 | + num_resize_up_ += 1; | |
| 514 | 525 | } |
| 526 | + prev_frame_width[sl] = pkt->data.frame.width[sl]; | |
| 527 | + prev_frame_height[sl] = pkt->data.frame.height[sl]; | |
| 515 | 528 | } |
| 516 | 529 | } |
| 517 | 530 | |
| @@ -571,6 +584,10 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc { · 53 unmodified lines | ||
| 571 | 584 | bool denoiser_off_on_; |
| 572 | 585 | // Top layer enabled on the fly. |
| 573 | 586 | bool denoiser_enable_layers_; |
| 587 | + int num_resize_up_; | |
| 588 | + int num_resize_down_; | |
| 589 | + unsigned int prev_frame_width[VPX_MAX_LAYERS]; | |
| 590 | + unsigned int prev_frame_height[VPX_MAX_LAYERS]; | |
| 574 | 591 | |
| 575 | 592 | private: |
| 576 | 593 | virtual void SetConfig(const int num_temporal_layer) { |
| @@ -841,8 +858,12 @@ TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc3SL_SingleLayerResize) { · 264 unmodified lines | ||
| 841 | 858 | ResetModel(); |
| 842 | 859 | dynamic_drop_layer_ = true; |
| 843 | 860 | single_layer_resize_ = true; |
| 861 | + base_speed_setting_ = speed_setting_; | |
| 844 | 862 | AssignLayerBitrates(); |
| 845 | 863 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 864 | + // Expect at least one resize down and at least one resize back up. | |
| 865 | + EXPECT_GE(num_resize_down_, 1); | |
| 866 | + EXPECT_GE(num_resize_up_, 1); | |
| 846 | 867 | // Don't check rate targeting on two top spatial layer since they will be |
| 847 | 868 | // skipped for part of the sequence. |
| 848 | 869 | CheckLayerRateTargeting(number_spatial_layers_ - 2, number_temporal_layers_, |