Reland "Add test for odd sizes with spatial layers"

This is a reland of 6fe3fa14c6686ba9c51095b97ad2e6833a9b03e5

Original change's description:
> Add test for odd sizes with spatial layers
>
> Bug: webrtc:12398
> Change-Id: If28f22f8c08913315806d26ad0b355eabda67da6
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/203889
> Reviewed-by: Philip Eliasson <philipel@webrtc.org>
> Commit-Queue: Jerome Jiang <jianj@google.com>
> Cr-Commit-Position: refs/heads/master@{#33319}

TBR=philipel@webrtc.org

Bug: webrtc:12398
Change-Id: I0c52a5d2d503180793603c148b3211df3ca035e1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208640
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33336}
This commit is contained in:
Sergio Garcia Murillo
2021-02-18 14:54:42 +01:00
committed by Commit Bot
parent 61d1773c03
commit dac39c5b1e

View File

@ -103,6 +103,23 @@ TEST(LibaomAv1EncoderTest, SetsEndOfPictureForLastFrameInTemporalUnit) {
EXPECT_TRUE(encoded_frames[5].codec_specific_info.end_of_picture);
}
TEST(LibaomAv1EncoderTest, CheckOddDimensionsWithSpatialLayers) {
std::unique_ptr<VideoEncoder> encoder = CreateLibaomAv1Encoder();
VideoCodec codec_settings = DefaultCodecSettings();
// Configure encoder with 3 spatial layers.
codec_settings.SetScalabilityMode("L3T1");
// Odd width and height values should not make encoder crash.
codec_settings.width = 623;
codec_settings.height = 405;
ASSERT_EQ(encoder->InitEncode(&codec_settings, DefaultEncoderSettings()),
WEBRTC_VIDEO_CODEC_OK);
EncodedVideoFrameProducer evfp(*encoder);
evfp.SetResolution(RenderResolution{623, 405});
std::vector<EncodedVideoFrameProducer::EncodedFrame> encoded_frames =
evfp.SetNumInputFrames(2).Encode();
ASSERT_THAT(encoded_frames, SizeIs(6));
}
TEST(LibaomAv1EncoderTest, EncoderInfoProvidesFpsAllocation) {
std::unique_ptr<VideoEncoder> encoder = CreateLibaomAv1Encoder();
VideoCodec codec_settings = DefaultCodecSettings();